Sign in to follow this  
Followers 0
Naufuge

#include <$var>

8 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

Ok Thanks

(Darn...)

Share this post


Link to post
Share on other sites

#4 ·  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

[center]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.[/center]

Share this post


Link to post
Share on other sites

(Darn...)

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

Share this post


Link to post
Share on other sites

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())

Share this post


Link to post
Share on other sites

#7 ·  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

Share this post


Link to post
Share on other sites

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

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

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