Greenhorn Posted May 27, 2008 Share Posted May 27, 2008 Moin, I have a problem with FileInstall. In my include script I have a FileInstall call and if I compile just the include script all is righty right, but if I compile the main script I get an error message: Invalid FileInstall() function: I could call the FileInstall() in the main script but it's not a good/clean solution. So, please, could somebody out there tell me a better solution ? Thx. Greetz Greenhorn Link to comment Share on other sites More sharing options...
Monamo Posted May 27, 2008 Share Posted May 27, 2008 Moin, I have a problem with FileInstall. In my include script I have a FileInstall call and if I compile just the include script all is righty right, but if I compile the main script I get an error message: Invalid FileInstall() function: I could call the FileInstall() in the main script but it's not a good/clean solution. So, please, could somebody out there tell me a better solution ? Thx. Greetz GreenhornWhat's your data structure like? That is, what is the relationship between the folder location of your #include script and the file you're trying to package? Are you using the full file path for your FileInstall usage? - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
Greenhorn Posted May 27, 2008 Author Share Posted May 27, 2008 It is all in the same folder: main.au3 include.au3 Au3Zipc.dll The include.au3 has the FileInstall call. Greetz Link to comment Share on other sites More sharing options...
roofninja Posted May 27, 2008 Share Posted May 27, 2008 It is all in the same folder:main.au3include.au3Au3Zipc.dllThe include.au3 has the FileInstall call.GreetzI don't think that you can do this with autoit. I think that when the program is compiled, the includes need to be with the rest of the program. It looks as though you are trying to create modules like a css in HTML or Java. I would put it all in one file and create function calls for different parts of the program. Am I understanding what you are doing? RUN . . . Slide . . . TAG . . . Your out . . . PAINTBALL !!! Link to comment Share on other sites More sharing options...
Developers Jos Posted May 27, 2008 Developers Share Posted May 27, 2008 It is all in the same folder:main.au3include.au3Au3Zipc.dllThe include.au3 has the FileInstall call.GreetzJust tried this and works fine as far as I can tell. please show some code to replicate the issue. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 27, 2008 Share Posted May 27, 2008 (edited) Moin, I have a problem with FileInstall. In my include script I have a FileInstall call and if I compile just the include script all is righty right, but if I compile the main script I get an error message: Invalid FileInstall() function: I could call the FileInstall() in the main script but it's not a good/clean solution. So, please, could somebody out there tell me a better solution ? Thx. Greetz Greenhorn Are the main script, include file, and "installed" file in different directories? Then a relative path that works from the include's directory might not be valid from the main script's directory. For example: I have a script at C:\Test\Script.au3: #include <SubTest\Include.au3> MsgBox(64, "Done", "Done") The include file is at C:\Test\SubTest\Include.au3: If FileInstall("MyInstalledFile.txt", @ScriptDir & "\MyTextFile.txt") Then MsgBox(64, "Success", "Successfully installed file.") Else MsgBox(16, "Failure", "Failed to install file.") EndIf The text file to be installed is at C:\Test\SubTest\MyInstalledFile.txt (contents are irrelevant). If I compile Include.au3, it finds the file MyInstalledFile.txt because it is located in the same directory with the include. If I compile Script.au3 it fails because from that directory, the text file does not exist. The fix is to fully path out your source file path. If I change that line in Include.au3 to the following, both files compile successfully: If FileInstall("C:\Test\SubTest\MyInstalledFile.txt", @ScriptDir & "\MyTextFile.txt") Then[code=auto:0] Edit: Added demo. Edited May 27, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Greenhorn Posted May 27, 2008 Author Share Posted May 27, 2008 (edited) OK, fourth try to edit the post ...In the main.au3 the function DownloadAutoIt3(@ScriptDir & '\' & $szAppFolder, 1)expandcollapse popupFunc GetAppDir() Local $szDir, $iMsg ; IniRead AutoIt3pDir ... $szDir = IniRead($szAppIniFile, 'Settings', 'AutoIt3pDir', '') If $szDir Then If FileExists($szDir & '\AutoIt3.exe') Then Return $szAppDir EndIf ; Pfad zum Ordner der Startdatei suchen. $szDir = FolderSearch($szDrive, $szAppFolder) If Not $szDir Then $iMsg = MsgBox(266308, $szAppName, 'Es wurde kein Ordner "' & $szAppFolder & '" auf Laufwerk "' & $szDrive & '" gefunden.' & @TAB & @CRLF & @CRLF & _ 'Möchtest Du die erforderlichen Dateien aus dem Internet herunterladen ?' & @CRLF & @CRLF) If $iMsg = 6 Then $szDir = DownloadAutoIt3(@ScriptDir & '\' & $szAppFolder, 1) If Not $szDir Then SetError(1, 0, '') Else Return $szDir EndIf Else SetError(1, 0, '') EndIf Else Return $szDir EndIf EndFuncoÝ÷ Øíè§r[y«·jëh×6Func DownloadAutoIt3($szDestDir, $bArchive) If $bArchive Then $sAutoItFile = 'autoit-v3-sfx.exe' $sSciTEFile = 'SciTE4AutoIt3.zip' ElseIf Not $bArchive Or $bArchive = 0 Or $bArchive = Default Then $sAutoItFile = 'autoit-v3-setup.exe' $sSciTEFile = 'SciTE4AutoIt3.exe' EndIf If Not FileExists($szDestDir) Then DirCreate($szDestDir) Local $hPluginDll, $szArchiveDir, $arDestDir, $szDirWGet, $szDirAutoIt, $szDirSciTE ; Au3Zip.dll entpacken. If Not FileExists($szDestDir & '\Au3Zipc.dll') Then FileInstall('Au3Zipc.dll', $szDestDir & '\Au3Zipc.dll') Sleep(500) $hPluginDll = PluginOpen('Au3Zipc.dll') $ProgressWnd = CreateProgressWindow() Sleep(1000) If Not FileExists($szDestDir & '\WGet\wget.exe') Then $szDirWGet = GetWGet($szDestDir, Default, Default, 1) Else $szDirWGet = $szDestDir & '\WGet' EndIf If Not FileExists($szDestDir & '\AutoIt3.exe') Then $szDirAutoIt = GetAutoIt3($szDestDir, $szDirWGet, Default, $sAutoItFile, 1) GetSciTE($szDirAutoIt, $szDirWGet, Default, $sSciTEFile, 1) Else If Not FileExists($szDestDir & '\SciTE\LUA\') Then GetSciTE($szDirAutoIt, $szDirWGet, Default, $sSciTEFile, 1) EndIf EndIf If Not FileExists($szDestDir & '\Extras\ResHacker\ResHacker.exe') Then GetResHacker($szDestDir & '\Extras\ResHacker', $szDirWGet, Default, 1) EndIf DirMove($szDirWGet, $szDestDir & '\Extras\WGet', 1) Sleep(2500) ; GUIDelete($ProgressWnd[0][0]) PluginClose($hPluginDll) Return $szDirAutoIt EndFunc ;==>DownloadPackageI hope this try is better...GreetzGreenhorn Edited May 27, 2008 by Greenhorn Link to comment Share on other sites More sharing options...
Greenhorn Posted May 27, 2008 Author Share Posted May 27, 2008 Sorry, problems with the editor ... Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 27, 2008 Share Posted May 27, 2008 (edited) Sorry, problems with the editor ... Just use code tags or codebox for longer stuff. The autoit tags are buggy and Jon doesn't have time to fix them and keep them up to date with current syntax. Anyway, this is the code that bombs: If Not FileExists($szDestDir & '\Au3Zipc.dll') Then FileInstall('Au3Zipc.dll', $szDestDir & '\Au3Zipc.dll') Likely Au3Zipc.dll is in the directory with the Include.au3, but would be a different path from where your main script is. You didn't bother to show the #include line from the main script, so we are still left guessing... Edited May 27, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Greenhorn Posted May 27, 2008 Author Share Posted May 27, 2008 Just use code tags or codebox for longer stuff. The autoit tags are buggy and Jon doesn't have time to fix them and keep them up to date with current syntax. Thank you for that info, Psalty ...Greetz Link to comment Share on other sites More sharing options...
Greenhorn Posted May 27, 2008 Author Share Posted May 27, 2008 (edited) Anyway, this is the code that bombs: If Not FileExists($szDestDir & '\Au3Zipc.dll') Then FileInstall('Au3Zipc.dll', $szDestDir & '\Au3Zipc.dll') Likely Au3Zipc.dll is in the directory with the Include.au3, but would be a different path from where your main script is. You didn't bother to show the #include line from the main script, so we are still left guessing... I tried it also without the if case = same result ! And if I compile only the include.au3 all is ok, with If ... Then and without If ... Then Edited May 27, 2008 by Greenhorn Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 I tried it also without the if case = same result ! And if I compile only the include.au3 all is ok, with If ... Then and without If ... ThenDid you read my previous posts after I edited them? The If/Then has nothing to do with the problem. You still haven't shown what the #include line looks like and stated if the files are ALL in the same directory or not. You also haven't said you tried giving the full path to the source file. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Greenhorn Posted May 28, 2008 Author Share Posted May 28, 2008 (edited) Sorry,OK, yes I tried it also with absolute path like: FileInstall('D:\AutoIt\Projekte\AutoIt potable\Au3Zipc.dll', $szDestDir & '\Au3Zipc.dll')the include line in AutoIt3pEx.au3 ('main.au3'):#Include 'GetAutoIt3p.au3'GetAutoIt3p.au3 is the 'include.au3'The project folder:Greetz Edited May 28, 2008 by Greenhorn Link to comment Share on other sites More sharing options...
Danny35d Posted May 28, 2008 Share Posted May 28, 2008 Anyway, this is the code that bombs: If Not FileExists($szDestDir & '\Au3Zipc.dll') Then FileInstall('Au3Zipc.dll', $szDestDir & '\Au3Zipc.dll')Most likely the part that is failing is the value of $szDestDir. I took a look to you code in post #7 and in function GetAppDir() you have the following line: $szDir = DownloadAutoIt3(@ScriptDir & '\' & $szAppFolder, 1) But you never assign any value to $szAppFolder AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 Most likely the part that is failing is the value of $szDestDir. I took a look to you code in post #7 and in function GetAppDir() you have the following line: $szDir = DownloadAutoIt3(@ScriptDir & '\' & $szAppFolder, 1) But you never assign any value to $szAppFolder It looks like the main script, include file, and installed file are all in the same folder, so your theory looks better than mine right now. But he uses the $szAppFolder variable elsewhere before that call, including displaying it as the title and in the text of a MsgBox(). Seems like it would get noticed if it wasn't set. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Danny35d Posted May 28, 2008 Share Posted May 28, 2008 It looks like the main script, include file, and installed file are all in the same folder, so your theory looks better than mine right now. But he uses the $szAppFolder variable elsewhere before that call, including displaying it as the title and in the text of a MsgBox(). Seems like it would get noticed if it wasn't set. I'm sure if he is using SciTE it will get noticed if $szAppFolder wasn't set. The question will be what is the value of $szAppFolder? or if $szAppFolder path exists, if not he need to use DirCreate($szAppFolder) and then FileInstall(). AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Greenhorn Posted May 28, 2008 Author Share Posted May 28, 2008 (edited) Moin,Global $szAppFolder = 'AutoIt3p'The $szAppFolder is not existing at compiletime !So, if the folder $szAppFolder is not existing on the drive, the main.au3 calls the function DownloadAutoIt3() in the include.au3.In the function DownloadAutoIt3() the script shall check if the Au3Zipc.dll already exist in $szDestDir, in case of not the DLL should be extrated.GreetzGreenhorn Edited May 28, 2008 by Greenhorn Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 (edited) Moin, Global $szAppFolder = 'AutoIt3p' The $szAppFolder is not existing at compiletime ! So, if the folder $szAppFolder is not existing on the drive, the main.au3 calls the function DownloadAutoIt3() in the include.au3. In the function DownloadAutoIt3() the script shall check if the Au3Zipc.dll already exist in $szDestDir, in case of not the DLL should be extrated. Greetz Greenhorn Think about compile-time and run-time separately: That destination folder doesn't have to actually exist at compile time, which is when you were getting the error. At compile time it just needs to find the file that needs to be compressed and added to the script .exe file. This is why variables are not allowed in the FileInstall() source and full paths should be used for the source file location. If it compiles correctly and then FileInstall() fails at run time, then you might have a problem with your destination path. Edited May 28, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Greenhorn Posted May 28, 2008 Author Share Posted May 28, 2008 (edited) If I compile the GetAutoIt3p.au3 - means the include.au3 - as a standalone EXE = No error -> no problem.If I compile the AutoIt3pEx.au3 - means the main.au3 - including the GetAutoIt3p.au3 - means the include.au3 - the error occures like in my first post.Greetzp.s. Now my damaged spinal disk needs alittle break, I'll be back in round about 45 minutes, thanks to all of you !!! Edited May 28, 2008 by Greenhorn Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 (edited) If I compile the GetAutoIt3p.au3 - means the include.au3 - as a standalone EXE = No error -> no problem.If I compile the AutoIt3pEx.au3 - means the main.au3 - including the GetAutoIt3p.au3 - means the include.au3 - the error occures like in my first post.Greetzp.s. Now my damaged spinal disk needs alittle break, I'll be back in round about 45 minutes, thanks to all of you !!!This topic is getting long and confusing. Can you post a SHORT demo that will reproduce your symptoms? Similar to what I posted in post #6, but reproducing your issue. Like a main script in 10 lines or less, and the include file in 5 lines or less, with a simple one-line text file for the include. Then we can just put those three files in one folder and try it. Edited May 28, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now