Jump to content

AutoIT macro (or variable) question


Recommended Posts

Hey guys :hello:

In have a question about autoIT.

I want to mount an image with Daemon Tools. This on itself isn't a problem.

Run ("C:\Program Files\D-Tools\daemon.exe -mount 0,D:\Install\battlefield\BFV_1.iso")

The line above works. The only problem here is that I use an absolute file path.

I want all file patchs ("C:\Program Files\D-Tools\daemon.exe & D:\Install\battlefield\BFV_1.iso) to be relative.

With the program file patch this is easy:

Run (@ProgramFilesDir & "\D-Tools\daemon.exe -mount 0,D:\Install\battlefield\BFV_1.iso")

Now I want to get rid of D:\ . For this I want to use @ScriptDir

How do I put this inside the line?

Edit:

I tried it like this: but the Daemon tools tells me that the image can't be mounted :(

Run (@ProgramFilesDir & "\D-Tools\daemon.exe -mount 0,@ScriptDir\BFV_1.iso")

Edited by erik_demon
Link to comment
Share on other sites


it basically just adds to some thing prior...in the above case it adds a macro to a text string, then adds another text string to that.

Heh its the same as the start where you have:

Run (@ProgramFilesDir & "\D-Tools\...

which joins what ever the pathing info is contained in @ProgramFilesDir to "\D-Tools\..., so its just splicing in info...its the same thing you have been doing...just placed some where else is all. :)

Okay more of an example

"\D-Tools\"

is the same as

"\" & "D" & "-" & "T" & "o" & "o" & "l" & "s" & "\"

More examples ;)

Okay we know that @ScriptDir macro contains the pathing information of where the active script is located, in your example "D:\Install\battlefield".

Now lets say we need the 8.3 file name conversion...short name in other words. Well we also know that by using the fuction "FileGetShortName" that it will return the 8.3 naming information that we need, example:

$a = FileGetShortName("C:\Program Files")
;$a is probably "C:\PROGRA~1"

But in our case it would need to be:

$a = FileGetShortName(@ScriptDir)
;$a is probably "D:\Install\battlefield"

So if we needed 8.3 file naming in it, then the line would look some thing like so:

Run (@ProgramFilesDir & "\D-Tools\daemon.exe -mount 0," & FileGetShortName(@ScriptDir) & "\BFV_1.iso")

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
  • Recently Browsing   0 members

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