Restored from previous forum. Originally posted by PB.
Would it please be possible that when using RunProgram that the editor can run
the app by searching the normal Windows paths? At the moment, running this code
results in a "File not found" error in the editor, because no absolute path has
been specified... meaning that I have to compile to an exe just to test the code:
RunProgram("calc.exe","",0) ; File not found!
See what I mean? I don't want to add the absolute path because then it won't
work on all versions of Windows (C:\Windows, C:\WinNT, etc)....
PB - Registered PureBasic Coder
RunProgram suggestion
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
I think, a problem there is that RunProgram should also work with Linux and
Amiga.
Why don't you just do it like this?
Works on every windows version.
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
I think, a problem there is that RunProgram should also work with Linux and
Amiga.
Why don't you just do it like this?
Code: Select all
windir.s = Space(261)
GetWindowsDirectory_(@windir, 261)
RunProgram(windir+"\calc.exe","",0)
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> Why don't you just do it like this? [snip]
Because the Windows folder was just an example... I want to be able to run any
executable without specifying the path, because the path is already set via an
environment variable.
PB - Registered PureBasic Coder
Edited by - PB on 07 August 2002 02:39:17
> Why don't you just do it like this? [snip]
Because the Windows folder was just an example... I want to be able to run any
executable without specifying the path, because the path is already set via an
environment variable.
PB - Registered PureBasic Coder
Edited by - PB on 07 August 2002 02:39:17
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
If you have set the path using an environment variable.. then use GetEnvironmentVariable to retrieve it.
This code snippet runs an app called TEST.EXE whos path is defined by the environment variable TEMP.
variablename.s="TEMP"
buffer.s=Space(256)
result=GetEnvironmentVariable_(@variablename,@buffer,256)
RunProgram(buffer+"\test.exe","",0)
If you have set the path using an environment variable.. then use GetEnvironmentVariable to retrieve it.
This code snippet runs an app called TEST.EXE whos path is defined by the environment variable TEMP.
variablename.s="TEMP"
buffer.s=Space(256)
result=GetEnvironmentVariable_(@variablename,@buffer,256)
RunProgram(buffer+"\test.exe","",0)