Sign in to follow this  
Followers 0
boltc

run another file from another dir.

13 posts in this topic

#1 ·  Posted (edited)

srry for my very bad english

i want to run a file for another dir.. how can i do this?

the file is located to data\eph.reg

i did this before,

Run("C:\Documents and Settings\Nieuwe bo\Mijn documenten\my program\data\eph.reg", "")

(the exe file(that you need to run) is located to

C:\Documents and Settings\Nieuwe bo\Mijn documenten\my program\

but if someone else download my program and exact it to somewhere else, it doesnt work....

i tried thiks like this but doesnt work:

Run("data\eph.reg", "")

Run("eph.reg", "data")

the readme says this:

Run ( "filename" [, "workingdir" [, flag]] )

Parameters

filename The full name of the executable (EXE, BAT, COM, or PIF) to run.

workingdir [optional] The working directory.

flag [optional] The "show" flag of the executed program:

@SW_HIDE = Hidden window

@SW_MINIMIZE = Minimized window

@SW_MAXIMIZE = Maximized window

someone know how to fix this problem?

Edited by boltc

Share this post


Link to post
Share on other sites



might want to try something like

Run(@ScriptDir & "\eph.reg")

nope, dont work ;)

Share this post


Link to post
Share on other sites

I believe that Gary meant this:

run(@scriptDir & "\data\eph.reg")

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I believe that Gary meant this:

run(@scriptDir & "\data\eph.reg")
nope, same error Edited by boltc

Share this post


Link to post
Share on other sites

If script.exe is located in C:\folder, eph.reg is located in C:\folder\data and script.exe wants to run eph.reg, then script.exe must call:

run(@scriptDir & "\data\eph.reg")

If this is not what you are asking, please explain further. ;)

Share this post


Link to post
Share on other sites

nope, same error

If you use fileinstall to include eph.reg then you will know exactly where the file is and @scriptDir will work.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

If script.exe is located in C:\folder, eph.reg is located in C:\folder\data and script.exe wants to run eph.reg, then script.exe must call:

run(@scriptDir & "\data\eph.reg")

If this is not what you are asking, please explain further.

that is exactly what i mean, but it still dont work..

maybe do i need to add somethink like this on the top of the script?

#include <GuiConstants.au3>

---------------------------------------------------------------------

If you use fileinstall to include eph.reg then you will know exactly where the file is and @scriptDir will work.

how to include it when it is in the data dir? Edited by boltc

Share this post


Link to post
Share on other sites

Try adding this line to your script:

local $file = @scriptDir & "\data\eph.reg"
  msgBox(0x40, $file, fileExists($file))

It will display a message box containing the full path to eph.reg and a number, where 1 means that the file exists and 0 means that it doesn't.

  • If the box reports 0 then you will need to modify $file until it reports 1.

  • If the box reports 1 already then it is another issue.

Share this post


Link to post
Share on other sites

The last time I checked, *.reg files were not executable files but rather they invoked an executable to run them.

Share this post


Link to post
Share on other sites

Oops, good point. Feeling like an ass. It's easy (when not testing) to forget that the Run() and RunWait() commands only work with executables. Try this:

$file = @scriptDir & "\data\eph.reg"
run(@comSpec & ' /c start "" "' & $file & '"', "", @SW_HIDE)

If you want the script to pause until the process completes, try this:

$file = @scriptDir & "\data\eph.reg"
  runWait(@comSpec & ' /c start "" /wait "' & $file & '"', "", @SW_HIDE)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

by LxP

$file = @scriptDir & "\data\eph.reg"
run(@comSpec & ' /c start "" "' & $file & '"', "", @SW_HIDE)
thanks.. it works Edited by boltc

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