Page 1 of 1

Filerequest Problem on Win

Posted: Sat Apr 24, 2010 11:32 pm
by Murmel
Hi.

I have problems with this code on Windows. This save the new Game.exe

Code: Select all

game$ = FileRequest("Select your Game.exe","")
	If game$ = ""
		;Print("Requester cancelled!")
	Else
		game1$ = FilePart(game$)
		game1$ = LeftStr(game1$,14) ;Beschränkung auf 14 Zeichen sonst überschreibt die Scuibox Icons
		scui.Set("StringBox3", { Value = game1$  }, 0)  ;GAME übergeben
		fSaveGameExe
		info$ = game$
		info$ = AddStr (Info$, " as EXE saved.")
		SystemRequest("Information",info$,"Ok")
	EndIf
Under MorphOS it works fine. On Windows, I get the message "Windows can not find c: \ Program"
The save Path ist C:\Program Files (x86)\ioquake3\ioquake3.exe

Is this a problem with spaces? And what can I do? Thx:)

Bye,

Murmel

Re: Filerequest Problem on Win

Posted: Sun Apr 25, 2010 12:15 am
by Murmel
Sorry edit not work ?

Function save
The saved Path is correct

Code: Select all

;---Funktion Game.exe abspeichern
Function fSaveGameExe(msg)
;---Prüfung ob exe auch existiert---
result=Exists(game$)
If result <> 1
     SystemRequest("Information","No Game Executable found","OK")
     Gamefound = 0 ;Exe nicht gefunden
EndIf
;If Gamefound = 0
;        sel = SystemRequest("Information","No Exe Found! Really Write This ?","Yes|No")
;       Switch sel
       

  If Eingabe = 1
    ObjektID = scui.GetIFOID("StringBox3")
    Obj=scui.Get(ObjektID)
    game$=Obj.value
  EndIf
  ;Else
  If StrLen(game$) <= 0
	game$ = "No EXE!"
	game1$ = "No EXE!"
  EndIf
OpenFile(2, "game.txt", #MODE_WRITE)
    WriteLine(2, game$)
CloseFile(2)
Gamefound = 1 ;Annahme Exe stimmt
;---Game.exe einlesen---
OpenFile(2, "game.txt")
    game$ = ReadLine(2)
CloseFile(2)
game1$ = FilePart(game$) ; Name der exe nicht Pfad
game1$ = LeftStr(game1$,14) ;Beschränkung auf 14 Zeichen sonst überschreibt die Scuibox Icons
     ; EndSwitch
     ; Else
;EndIf
EndFunction

Re: Filerequest Problem on Win

Posted: Sun Apr 25, 2010 9:22 am
by amigaoneproductions
Hi,

It's your file request that is missing the "writemode" option,

Try this :

game$ = FileRequest("Select your Game.exe","",#REQ_SAVEMODE)

We had a similar post about this a while ago, take a look at

viewtopic.php?f=4&t=5#p64

for more info

Re: Filerequest Problem on Win

Posted: Sun Apr 25, 2010 1:31 pm
by Murmel
Hi.

Thanks for the tip:)
However, the problem remains under winxp 64bit

Re: Filerequest Problem on Win

Posted: Mon Apr 26, 2010 12:03 am
by Murmel
edit not work ;)

No Windows saves the Path correct with Space

This code reads no spaces

;---Game.exe einlesen---
OpenFile(2, "game.txt")
game$ = ReadLine(2)
CloseFile(2)
game1$ = FilePart(game$) ;Enthält nur den Namen der Game.exe, und nicht den Pfad
game1$ = LeftStr(game1$,14) ;Beschränkung auf 14 Zeichen sonst überschreibt die Scuibox Icons