Main Menu

ExeFile options

Started by Jeku, February 07, 2005, 09:29:28 PM

Previous topic - Next topic

Jeku

Hello,

Is there any way to uses the EXEFILE command with switches?  I've tried "notepad.exe help.txt" but it exits with an error.  Just "notepad.exe" by itself works fine.

Any ideas why?
**
Automaton Games - Home of WordTrix 2.0, WordZap, and GameBasic
Jeku's Music - Easy listening electronic...
**

kevin

I'd say you'd have the wrap the file your exe'ing parameters in quotes..  

ie.
execfile "notepad.exe "+chr$(34)+"help.txt"+chr$(34)

Jeku

Sadly that doesn't work either.  I think PlayBasic has a problem with more that one word in the ExeFile command.  NOTEPAD.EXE and IEXPLORE.EXE work fine by themselves, but if you pass anything them then PlayBasic gives a file not found error.
**
Automaton Games - Home of WordTrix 2.0, WordZap, and GameBasic
Jeku's Music - Easy listening electronic...
**

empty

Yeah, having troubles here too. Unless I specify the complete path it won't even start notepad.exe. For the time being you can use this function:


Constant SW_HIDE     = 0
Constant SW_MAXIMIZE   = 3
Constant SW_MINIMIZE   = 6
Constant SW_RESTORE    = 9
Constant SW_SHOW    = 5
Constant SW_SHOWDEFAULT  = 10
Constant SW_SHOWMAXIMIZED = 3
Constant SW_SHOWMINIMIZED = 2
Constant SW_SHOWMINNOACTIVE= 7
Constant SW_SHOWNA    = 8
Constant SW_SHOWNOACTIVATE = 4
Constant SW_SHOWNORMAL   = 1


Psub WinExec(CmdLine$, CmdShow)
Local Kernel32 = GetFreeDll()
LoadDll "kernel32",Kernel32
Local Result = CallDll(Kernel32, "WinExec", CmdLine$, CmdShow)
DeleteDll Kernel32
EndPsub Result

; TESTING 1,2,3...
WinExec("Notepad.exe 'c:\Test.txt'", SW_SHOWNORMAL)
Print "Notepad started"
Sync
WaitKey

kevin

hmm, If it traps a file no found then it must check a file exists before running it.   Obviously it doesn't strip the filename of any extra tokens before checking it's state.  Will have to add that to the 1.06x  list :)

Jeku

Empty - Thanks for the awesome code sample, it works!  Now I can use that for my online high score table :-)
**
Automaton Games - Home of WordTrix 2.0, WordZap, and GameBasic
Jeku's Music - Easy listening electronic...
**