t0ddie Posted November 27, 2004 Posted November 27, 2004 i am running a script just fine, and for some reason on my friends computer he gets an autoit error, line 0 endif with no matching if statement and i dont get that error. why is this? where is line 0? lol Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
t0ddie Posted November 27, 2004 Author Posted November 27, 2004 (edited) i sent it compiled its 2 files the file i want to run, and a starter file heres the starter file, but i he dont get the error for that file FileInstall ("C:\Documents and Settings\Administrator\Desktop\123.exe",@desktopDir & "\123.exe") Run ("123.exe",@desktopDir,1 ) he gets an error for the other file. 123.exe and i ran it, i get no error, why does it say line 0? how can the error be on a non existant line? Edited November 27, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
CyberSlug Posted November 27, 2004 Posted November 27, 2004 If any compiled script crashes, it reports line 0. (I imagine the reason is that all blank lines and comments are removed before compiling, and the line numbers in the compiled file might not match up with AutoIt script...... so it just reports line 0 to be safe.) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
t0ddie Posted November 27, 2004 Author Posted November 27, 2004 well its not crashing for me, and on my friends computer he gets an endif with no matching if statement error. does anyone know what could be causing this? it works for me, so i dont see how there could be an error in the code Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
Valik Posted November 27, 2004 Posted November 27, 2004 How exactly are we supposed to tell you any more than the error message your friend is getting if we can't see the code?
this-is-me Posted November 27, 2004 Posted November 27, 2004 (edited) What is the source of 123.exe ? EDIT: Wait a minute, Run (@DesktopDir & "\123.exe") DUH! *Rolls up newspaper* *whap whap whap* NO, Bad t0ddie! Edited November 27, 2004 by this-is-me Who else would I be?
CyberSlug Posted November 28, 2004 Posted November 28, 2004 What is the source of 123.exe ?EDIT: Wait a minute, Run (@DesktopDir & "\123.exe")DUH!*Rolls up newspaper**whap whap whap*NO, Bad t0ddie!<{POST_SNAPBACK}>Good catch I guess we still need fix the docs for Run.... add big red flashing text "Working Directory does not mean the path to the executable." Admittedly, it's not that clear in the help file.... Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Developers Jos Posted November 28, 2004 Developers Posted November 28, 2004 True that the run() is wrong but it won't generate the error: line 0 endif with no matching if statement 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.
erebus Posted November 28, 2004 Posted November 28, 2004 EDIT: Wait a minute, Run (@DesktopDir & "\123.exe")DUH!*Rolls up newspaper**whap whap whap*NO, Bad t0ddie!<{POST_SNAPBACK}>AHAHAHAHAAHAH, you made my day!
t0ddie Posted November 28, 2004 Author Posted November 28, 2004 actually, heh i remember that you cant use a macro as the installation file. but in my script, it gives the full path, i just changed that part for my post, i dont know why lol but yeah, thats not the problem the problem is 123.exe and i run the code, i get no problems but this other guy runs it, and gets that error about the endif i even erased the last endif, and it wouldnt compile, obviously well, then i fixed it, and it compiles fine, and runs fine, but not on this other guys computer go figure Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
CyberSlug Posted November 28, 2004 Posted November 28, 2004 Are you still looking for help from us? There really isn't any more we can tell you unless you follow Valik's advice above Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
t0ddie Posted November 28, 2004 Author Posted November 28, 2004 (edited) the thing is, i know the code works..... and it would be pointless to add it here BUT its the same code that has worked for me forever.... i have rewritten it slightly (changed the names of variables) but its not even my code mostly lol its larry's $5 = DriveGetDrive( "fixed") If Not @error Then $6 = "" $7 = "" For $8 = 1 To $5[0] $6 = $6 & $5[$8] & "," Next While $6 <> "" $9 = StringLeft($6, StringInStr($6, ",") - 1) & "\" $6 = StringTrimLeft($6, StringInStr($6, ",")) $0 = FileFindFirstFile($9 & "*.*") If $0 > - 1 Then $a = FileFindNextFile($0) While Not @error And $a <> "" If $a <> "." And $a <> ".." And _ StringInStr(FileGetAttrib($9 & $a), "D") Then $6 = $6 & $9 & $a & "," $7 = $9 & $a & "\" msgbox(0,"test",$7) EndIf $a = FileFindNextFile($0) Wend FileClose($0) EndIf Wend EndIf i know its harder to follow this way, but this is pretty much what i have right now and this is what i am testing. pretty much it goes one by one and puts a directory into a messagebox. not as practical as a file i know, but this is just a test to see if the code works. and it does then i compile this, and i then compile my start file which installs this file (123.exe) to another directory and runs it. thats when he gets the endif with no matching if error. and its line 0 in 123.exe the real problem that bothers me is this.. if ii get an error on some guys computer, why does it work on mine? same exact code. EDIT: the post here has proper indentation, yet its not posting it in the reply for some reason. sorry. Edited November 28, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
CyberSlug Posted November 28, 2004 Posted November 28, 2004 Some misc comments:1) Have you tried running the uncompiled script on the guy's computer? Just copy AutoIt3.exe and yourScript.au3 to the guy's computer and run AutotIt3 to see if you get an exact line number.2) I wonder there could be an AutoIt bug in the way line-continued If statements are processe: If $a <> "." And $a <> ".." And _ StringInStr(FileGetAttrib($9 & $a), "D") Then3) Instead of saying If Not @error Then ..... EndIf you could say If @error Then Exit. My suggestion is not necessarily better, but it can reduce the amount of nested indention. Similarly, you could replace If $0 > - 1 Then with If $0 <= -1 Then ExitLoop4) In general it's preferred to use letters instead of numbers for single-character variable names.... $0 $1 $2 $3 all look strange to me 5) Report back the results of #1 if possible. Also get operating system information.Good Luck Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Scottswan Posted November 28, 2004 Posted November 28, 2004 (edited) thats when he gets the endif with no matching if error. and its line 0 in 123.exe the real problem that bothers me is this.. if ii get an error on some guys computer, why does it work on mine? same exact code.<{POST_SNAPBACK}>What OS's are each of you running?As CyberSlug pointed out above, a compiled script will spit out a "line 0" error on any error. So chances are that your script is fine but it's running into a snag with something on the other guys computer. An example: Maybe he's running XP as a standard user and doesn't have rights to install 123.exe wherever it's supposed to go.One test you could do... have him install the latest AutoIt and run the script uncompiled...see what happens?-ScottEdit: Oops, 7 minutes behind CyberSlugs post ^....ditto, almost. Edited November 28, 2004 by Scottswan
this-is-me Posted November 28, 2004 Posted November 28, 2004 You're not overwriting the original file. If there's already a 123.exe on his desktop, then it runs the buggy previous version. Who else would I be?
t0ddie Posted November 29, 2004 Author Posted November 29, 2004 (edited) ooh ooh, ill bet thats it cause no matter what i do, its the same error. but, the script ran error free for me even BEFORE i sent it to my friend, who is not online right now.... so i cant ask him about it.. it could be that he tried it before when it was buggy still, so long ago that i cant remember, and that file is still there (not in the desktop, i just changed my code for all practical purposes because its easier to explain) and its running the old version. im using xp pro and im the administrator. and i run both the script and the compiled exe and it works for me. so pretty much, everyone who has ran this code, has had no problems right? also, if a file exists already, to overwrite it you put a flag at the end right? i got this FileInstall ("C:\Documents and Settings\Administrator\Desktop\123.exe",@desktopDir & "\123.exe") and i just thought of something, if the file is already there, it wont be rewritten with this code right? ill bet this is the culprit here, so i would want to change it to this right? FileInstall ("C:\Documents and Settings\Administrator\Desktop\123.exe",@desktopDir & "\123.exe",1) see? im thinking the problem is solved without even showing the code lol. that should be HIGHLIGHTED in the help file lol, about overwriting files when you install them. lol im such an idiot, i shall report back the datails of my findings in due time. Edited November 29, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
this-is-me Posted November 29, 2004 Posted November 29, 2004 (edited) lol im such an idiotAt least you admit it... that should be HIGHLIGHTED in the help file lol, about overwriting files when you install them.Quoting the helpfile about FileInstall:[optional]this flag determines whether to overwrite files if they already exist: 0 = (default) do not overwrite existing files 1 = overwrite existing files Edited November 29, 2004 by this-is-me Who else would I be?
t0ddie Posted November 29, 2004 Author Posted November 29, 2004 (edited) lol but it took you guys awhile to catch it. anyways he is the admin xp home edition but thats irrelivent, because im sure i know the problem i think im sure (ha!) and we are all idiots in some way. so dont think you are off the hook lol EDIT: i said HIGHLIGHTED damn it lol Edited November 29, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
this-is-me Posted November 29, 2004 Posted November 29, 2004 Well, with the miniscule amount of information given in the timespan allotted, the answer was given in record time. Who else would I be?
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