Jump to content

Recommended Posts

Posted

Its it possible to include a file thats location is stored in a var? Like

$File_OpenDialog = FileOpenDialog("Open File...",@ScriptDir,"Application (*.exe)",1+2+8+16)
#include <$File_OpenDialog>

Thanks

Brian

Posted

Quoting from the helpfile:

The filename of the current script to include. Path is optional. This must be a string--it cannot be a variable.

So the answer is no, the same limitation exist with FileInstall() too.

  • Moderators
Posted (edited)

Are you trying to include an executable? If so, use FileIntall()

Edit: Guess not on the variable... good catch erebus

Edit2: Note to self! Only answer questions when not multi-tasking!

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Because #Include is a preprocessor directive (notice the hash #), it is executed before any actual script code is processed.

Also, if the program is compiled and distributed, the #Include is replaced with the text of the file that is included (File.au3, Misc.au3, etc) and nothing else can be included 'on-the-fly'.

If you are looking for the functionality I suspect you want, maybe FileMove or FileCopy would do the trick.

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Posted (edited)

Use your head; there is _always_ a different approach to do what you want to do. :P

Like initially #Include-ing all of the possible script pieces and then using Call() or Execute() to invoke the appropriate functionality.

Edit: Added context.

Edited by LxP
Posted

I think that he wants to use #include's filename dynamically.

A good idea is to #include everything of course as LxP said.

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...