andygo Posted October 1, 2009 Share Posted October 1, 2009 hello,this is part of a script:_inst("a2.jpg", @TempDir & "\")Func _inst($checkfile, $checkdir) FileInstall("dummy", $checkdir & $checkfile, 1) ;MsgBox(64,"info", $checkdir & $checkfile & @CRLF & FileReadLine ( $checkdir & $checkfile, 1)) if FileReadLine ( $checkdir & $checkfile, 1) = "dummy" then FileInstall($checkfile, $checkdir & $checkfile, 1) else MsgBox(16,"Fehler", $checkdir & $checkfile & @CRLF & "konnte nicht erstellt werden!") endif Endfuncin SciTE Editor, the Syntax-Check says everything is ok, and i can run the script from there,all is fine, function works. but when i try to compile, the aut-2-exe says:what is wrong, why cant compile? Link to comment Share on other sites More sharing options...
jvanegmond Posted October 1, 2009 Share Posted October 1, 2009 Using FileInstall means on compile time a file must be included in the script executable. You are trying to include file "dummy", which apparently does not exist. You probably meant to type something like: FileInstall($checkfile, $checkdir & $checkfile, 1) github.com/jvanegmond Link to comment Share on other sites More sharing options...
andygo Posted October 1, 2009 Author Share Posted October 1, 2009 all the files i compile with the script exists. if i install them this way: FileInstall("a2.jpg", @TempDir & "\a2.jpg", 1) FileInstall("a2.jpg", @TempDir & "\a2.jpg", 1) FileInstall("av.jpg", @TempDir & "\av.jpg", 1) FileInstall("s07.jpg", @TempDir & "\s07.jpg", 1) FileInstall("i82.jpg", @TempDir & "\i82.jpg", 1) FileInstall("i_view32.exe", @TempDir & "\" & $precfg0 & "\" & $precfg0 & "i_view32.exe", 1) FileInstall("i_view32.ini", @TempDir & "\" & $precfg0 & "\i_view32.ini", 1) FileInstall("dummy", @TempDir & "\" & $precfg0 & "\_curlrc", 1); FileInstall("curl.exe", @TempDir & "\" & $precfg0 & "\" & $precfg0 & "curl.exe", 1); FileInstall("libeay32.dll", @TempDir & "\" & $precfg0 & "\libeay32.dll", 1); FileInstall("libssl32.dll", @TempDir & "\" & $precfg0 & "\libssl32.dll", 1); FileInstall("list.w", @TempDir & "\" & $precfg0 & "\list.w", 1) FileInstall("date.w", @TempDir & "\" & $precfg0 & "\date.w", 1) FileInstall("both.w", @TempDir & "\" & $precfg0 & "\both.w", 1) ;FileInstall("list-s.w", @TempDir & "\" & $precfg0 & "\list-s.w", 1) ;FileInstall("date-s.w", @TempDir & "\" & $precfg0 & "\date-s.w", 1) ;FileInstall("both-s.w", @TempDir & "\" & $precfg0 & "\both-s.w", 1) FileInstall("watermark.license", @TempDir & "\" & $precfg0 & "\watermark.license", 1) FileInstall("watermark.exe", @TempDir & "\" & $precfg0 & "\" & $precfg0 & "watermark.exe", 1) FileInstall("watermark.ini", @TempDir & "\" & $precfg0 & "\watermark.ini", 1) FileInstall("auto.htm", @TempDir & "\" & $precfg0 & "\auto.htm", 1); FileInstall("streamlite.htm", @TempDir & "\streamlite.htm", 1) DirCreate(@TempDir & "\" & $precfg0 & "\fgo"); ;FileInstall("dummy", @TempDir & "\" & $precfg0 & "\fgo\_curlrc", 1); FileInstall("curl.exe", @TempDir & "\" & $precfg0 & "\fgo\" & $precfg0 & "1curl.exe", 1); FileInstall("libeay32.dll", @TempDir & "\" & $precfg0 & "\fgo\libeay32.dll", 1); FileInstall("libssl32.dll", @TempDir & "\" & $precfg0 & "\fgo\libssl32.dll", 1) ; compiling works. i just get the error if i try to compile like my first post here Link to comment Share on other sites More sharing options...
jvanegmond Posted October 1, 2009 Share Posted October 1, 2009 (edited) THIS LINE IS WRONG. YOU ARE TRYING TO INCLUDE A FILE THAT DOES NOT EXIST. THE FILE IS NAMED DUMMY: FileInstall("dummy", $checkdir & $checkfile, 1) Edited October 1, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
andygo Posted October 1, 2009 Author Share Posted October 1, 2009 THIS LINE IS WRONG. YOU ARE TRYING TO INCLUDE A FILE THAT DOES NOT EXIST. THE FILE IS NAMED DUMMY: FileInstall("dummy", $checkdir & $checkfile, 1) sorry manadar, but you are wrong. if i point to a non-existing file, then this error is shown: Func _inst($checkfile, $checkdir) FileInstall("i-am-not-here.txt", $checkdir & $checkfile, 1) ;MsgBox(64,"info", $checkdir & $checkfile & @CRLF & FileReadLine ( $checkdir & $checkfile, 1)) if FileReadLine ( $checkdir & $checkfile, 1) = "dummy" then FileInstall($checkfile, $checkdir & $checkfile, 1) else MsgBox(16,"Fehler", $checkdir & $checkfile & @CRLF & "konnte nicht erstellt werden!") endif Endfunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 1, 2009 Moderators Share Posted October 1, 2009 andygo,As Manadar has, understandably, decided to leave this topic, let us see if a different voice can get through.Manadar has already told you that you are getting the error because you are trying to FileInstall a non-existent file. In the snippet you included in your first post this file was called "dummy".You are getting the error when you compile, and not when you run from SciTE, because of the different way FileInstall is handled in these 2 cases. From the Help file for FileInstall:When this function is used from a non-compiled script, a copy operation is performed instead (to allow for easy testing pre-compilation)Trying to copy a non-existent file does not worry Autoit - it just carries on. But trying to include a non-existent file in a compiled .exe obviously causes an error.Two options:1. Check if the file exists BEFORE using FileInstall (use FileExists) and do not try to include it if it is not there.2. Adjust your code so that it does not try to include non-existent files. I hope that this alternative explanation helps.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
andygo Posted October 1, 2009 Author Share Posted October 1, 2009 @melba & @manadar:i understand you both. please try this mini-script yourself,then you will see the error.just create an empty file "test1.txt" and another file "dummy.txt" withthe word "dummy" as its first line._inst("test1.txt", @TempDir & "\") Func _inst($checkfile, $checkdir) FileInstall("dummy.txt", $checkdir & $checkfile, 1) ;MsgBox(64,"info", $checkdir & $checkfile & @CRLF & FileReadLine ( $checkdir & $checkfile, 1)) if FileReadLine ( $checkdir & $checkfile, 1) = "dummy" then FileInstall($checkfile, $checkdir & $checkfile, 1) MsgBox(64,"Info", $checkdir & $checkfile & @CRLF & "is ok.") else MsgBox(16,"error", $checkdir & $checkfile & @CRLF & "failed!") endif Endfunc Link to comment Share on other sites More sharing options...
jvanegmond Posted October 1, 2009 Share Posted October 1, 2009 Yep, you're brilliant and we're all wrong. I think I'll be out now.Oh, also:FileInstall parameter 1 description: The source path of the file to compile. This must be a literal string; it cannot be a variable. It can be a relative path (using .\ or ..\ in the path).So this is wrong too:FileInstall($checkfile, $checkdir & $checkfile, 1) github.com/jvanegmond Link to comment Share on other sites More sharing options...
TurionAltec Posted October 1, 2009 Share Posted October 1, 2009 FileInstall($checkfile, $checkdir & $checkfile, 1)From the Help file on FileInstallRemarksThe FileInstall function is designed to include files into a compiled AutoIt script. These included files can then be "extracted" during execution of the compiled script if the statement is executed. Keep in mind that files such as images can greatly increase the size of a compiled script.The source file must be a string and not a variable so that the compiler can extract the filename to include. The source cannot contain wildcards. Link to comment Share on other sites More sharing options...
andygo Posted October 1, 2009 Author Share Posted October 1, 2009 (edited) hello again, i think i found a way to check, accessing, reading out an existing file: if _predel(@TempDir & "\a.jpg") = 1 then FileInstall("a.jpg", @TempDir & "\a.jpg", 1) func _predel($predel) FileInstall("dummy.txt", $predel, 1) if FileReadLine ( $predel, 1) = "dummy" then FileSetAttrib($predel, "-R", 1) FileDelete ( $predel ) Return 1 Else MsgBox(16, "Fehler", "Zugriffsfehler! Bitte manuell löschen:" & @CRLF & @CRLF & $predel & @CRLF & @CRLF & "Tool anschliessend neu starten.") exit endif EndFunc thank you for the time Edited October 1, 2009 by andygo Link to comment Share on other sites More sharing options...
jvanegmond Posted October 1, 2009 Share Posted October 1, 2009 (edited) The first parameter of FileInstall is NOT EVALUATED on compile time. In fact, nothing is evaluated on compile time. If False Then FileInstall("dummy.txt", "dummy.txt", 1)\ EndIf On compile time it WILL include dummy.txt Edited October 1, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
andygo Posted October 1, 2009 Author Share Posted October 1, 2009 The first parameter of FileInstall is NOT EVALUATED on compile time. If False Then FileInstall("dummy.txt", "dummy.txt", 1)\ EndIf On compile time it WILL include dummy.txt yes, in this case i want to include the dummy.txt. reason: it contains only one line with the word "dummy" and if the fileread also contains "dummy" i know that accessing works. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 1, 2009 Share Posted October 1, 2009 Ok, whatever, I just wondered why you were bumping your own topic after your question had been answered. github.com/jvanegmond Link to comment Share on other sites More sharing options...
andygo Posted October 1, 2009 Author Share Posted October 1, 2009 Ok, whatever, I just wondered why you were bumping your own topic after your question had been answered.that wasnt my intention, sry. you can change topic title to "Solved" and close it. p.s. xcuse my poor english, i'm livin in germany Link to comment Share on other sites More sharing options...
jvanegmond Posted October 1, 2009 Share Posted October 1, 2009 Ich habe schon verstanden das du Deutsch sprecht. github.com/jvanegmond 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