Jump to content

#include Path or Relative Path


Recommended Posts

Guest DJMZ.com

I have a set of install scripts and programs in a hierarchy:

Prog 1\

Install.au3

Setup.exe

Prog 2\

Install.au3

Setup.exe

Install All.au3

When I run any of the Install.au3 files they do their job just fine.

What I want to be able to do is run Install All.au3 with a load of #include lines to run them all in order. This works fine until I need to refer to a file in a folder, as the @ScriptDir path is always to the file that was run, in this case Install All.au3

I could set a variable $CurrentDir = "..." before every include, but this doubles the amount of work to set up the file. I've also considered calling the other files manually with some command line flags to tell it to skip the "Are you sure?" and "Finished" messages, which are only shown for the file that was run, but this seems like it could get messy.

So, does anyone have an easier way to get either the path to the current include, or the path relative to the main document?

Link to post
Share on other sites

You could instead of including the other au3 files, execute them. Have autoit run each script. Tested a sample script and reports @scriptdir correctly for the script being executed.

script 1

RunWait(@AutoItExe & ' Folder\2.au3')
MsgBox(0, '', 'I am back')

script 2

MsgBox(0, '', @ScriptDir)

This works fine for me.

script 1 should be able to batch all your scripts.

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

    No registered users viewing this page.

×
×
  • Create New...