Sign in to follow this  
Followers 0
Matthy

running a script thats not in the instal dir

5 posts in this topic

i want to make an program that runs other scripts in a subdir like script1\script1.exe and script2\script2.exe ect. well its not that hard to make a scrip like that its yust

Run ("script2\script2.exe")

but the problem is that that script reads an ini file and it cant find it when you run it like this. it probarly seaches for the ini in the dir of the program that tries to run the other program but i cant sett the ini there because this prog is meant to run more times the same prog with other ini settings

does anyone know something :) i tried anything..

thx matthy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If the ini file is in the initial script directory, and the executed script must read an ini that is in the initial script directory, you can do:

First (if the called scripts are one folder level up to the initial script dir):

IniRead("..\inifile.ini",.....

Or if the called scripts are in a more complex folder structure you can pass the initial dir as parameter to the script:

Example:

; ----- script 1 --------
Run('script2\script2.exe "' & @scriptdir & '"')


; ----- script 2 --------
IniRead($cmdline[1] & "\inifile.ini",.....

The script dir passed as parameter is enclosed in quotes to avoid errors if there are spaces in the dir names.

Edited by Leandro Conca

Share this post


Link to post
Share on other sites

im really sorry but i dont get it :)

Share this post


Link to post
Share on other sites

Ok,

I was thinking in the opposite scenario, that the ini file you were trying to read was in the main script directory!

But the ini files are in the called scripts dir, is that correct?

In that case, you can use the 2nd parameter of Run function, that is the working directory of the process.

You can do:

Run("dir\script2.exe","dir")

This will set the subdir called "dir" as the working directory of the "script2.exe" process. So, you can use IniRead() in the "script2" without specifying the full path to the ini file, and the script will look for it in the "dir" subdirectory.

Hope I didn't confuse you more!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

:):D thx dude it works :P

i am now ready to write my programm :D thx

Edited by Matthy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0