Sign in to follow this  
Followers 0
bittiez

FileInstall() function issues?

10 posts in this topic

So I have my script all ready to go, and it works flawlessly, but when I go to compile its telling me FileInstall() is an invalid function, is there some file I need to include for this to work properly?

Share this post


Link to post
Share on other sites



You're probably using it incorrectly, post your code or at least the part that includes the FileInstall section.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

hi bittiez,

No includes are required to use FileInstall() function, perhaps your syntax is incorrect; make sure the source files are specified as literal strings. See the help-file for more details on usage, if you still encounter difficulties, post a snippet of the code that doesn't work as expected and tell us the exact error details.

Hope this helps :unsure:

-smartee

Share this post


Link to post
Share on other sites

Exact details: "Invalid FileInstall() function:"

Yes, thats all it shows, it does not give me any more detail I'm afraid =/

FileInstall(@WorkingDir & "\tempdownload\" & $downloadfile & "\"& $app_i[$i], @WorkingDir & "\"& $app_i[$i], 21)

Which turns out to be something along the lines of:

FileInstall("C:\tempdownload\2\filename.txt", "C:\filename.txt", 21)

(The working dir, second level folder and file name all change from time to time, hence the use of variables and arrays)

I have already done consolwrites for the directories and filenames, they all check out, and this runs without any errors or warning when running it as a .au3..

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Exact details: "Invalid FileInstall() function:"

Yes, thats all it shows, it does not give me any more detail I'm afraid =/

FileInstall(@WorkingDir & "\tempdownload\" & $downloadfile & "\"& $app_i[$i], @WorkingDir & "\"& $app_i[$i], 21)

Read again the help file and you will see this bold text talking about source parameter: "This must be a literal string; it cannot be a variable or the result of a function call"

Edit: If you need to use Fileinstall() with many files in a directory, then you can take a look to this SmOke_N's program will write the code for you. Edited by sahsanu

Share this post


Link to post
Share on other sites

The FileInstall command requires the use of a literal path and file name, you can't use variables as the source for the file install. You can use variables as the destination but not for the source. The fileinstall is done at compile time, so the compiler won't know what your variables mean at that time.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Ah I see, thank you guys very much :unsure:

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Is there any way around this? Maybe a file move function? There is no way I can have the source be a specific file in my script =/

Nevermind, FileCopy works :unsure:

Edited by bittiez

Share this post


Link to post
Share on other sites

The only thing that you can do to make it so that it's in a semi-variable location is to use a relative path, FileInstall("test\testfile.ini" as an example would install the file testfile.ini that's located in the test folder under the script's folder. Or you could use a leading "\" to specify the root folder of the drive and a folder under that. That's about it, if the compiler can't find the file by the file path and file name, it will not install the file.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#10 ·  Posted

Is there any way around this? Maybe a file move function? There is no way I can have the source be a specific file in my script =/

Nevermind, FileCopy works :unsure:

If you're referring to moving the file to another folder when the script is run, you can use variables in the destination parameter. That will work because it's not acted upon until run time. It's only the source that can't use variables or macros.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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