Sign in to follow this  
Followers 0
Eigensheep

Another FileInstall problem

3 posts in this topic

Hi guys, firstly sorry for creating another thread. But I can't solve my problem using solutions posted in the forums.

So I have this script:

$file = @ScriptDir & "\files\tst.au3"
$directory = _GetDirPath($file)

FileInstall("C:\Users\Jordan\Documents\Autoit Files\Encryption" & "\Aut2exe.exe", $directory)
FileInstall("C:\Users\Jordan\Documents\Autoit Files\Encryption" & "\Aut2exe_x64.exe", $directory)
FileInstall("C:\Users\Jordan\Documents\Autoit Files\Encryption" & "\AutoItSC.bin", $directory)
FileInstall("C:\Users\Jordan\Documents\Autoit Files\Encryption" & "\AutoItSC_x64.bin", $directory)
FileInstall("C:\Users\Jordan\Documents\Autoit Files\Encryption" & "\Notes.ico", $directory)
FileInstall("C:\Users\Jordan\Documents\Autoit Files\Encryption" & "\upx.exe", $directory)

ShellExecuteWait(@ScriptDir & "\files\Aut2exe.exe", '/in "' & $file & '" /icon "' & $directory & 'Notes.ico"') 

FileDelete($directory & "Aut2exe.exe")
FileDelete($directory & "Aut2exe_x64.exe")
FileDelete($directory & "AutoItSC.bin")
FileDelete($directory & "AutoItSC_x64.bin")
FileDelete($directory & "Notes.ico")
FileDelete($directory & "upx.exe")

Func _GetDirPath($filepath)
   $i = StringInStr($filepath, "\", 0, -1)
   Return StringMid($filepath, 1, $i)
EndFunc

And when I compile I get the notorious error; "Invalid FileInstall() function:"

The files exist, are in the location specified, and I HAVE used a literal string as the first parameter of each call to the function. I also replaced all / with \ as suggested, but this hasn't solved it either. I get no such problem running the script normally. Can someone please explain what's going on?

Many thanks.

Share this post


Link to post
Share on other sites



Umm, this is awkward. I removed the " & " in each string and now it works. Sorry to have wasted your time, I hope this can help someone else in the future!

Share this post


Link to post
Share on other sites

This is because source path of the file must be a literal string & it cannot be a variable or the result of a function call.

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