Jump to content

run another file from another dir.


boltc
 Share

Recommended Posts

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
Link to comment
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. ;)

Link to comment
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.


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

Link to comment
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.

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
Link to comment
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.
Link to comment
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)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...