Sign in to follow this  
Followers 0
t0ddie

line 0 error

22 posts in this topic

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.

Share this post


Link to post
Share on other sites



Did he delete something?

LoL.

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

True that the run() is wrong but it won't generate the error:

line 0 endif with no matching if statement


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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! :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#13 ·  Posted (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 by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

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") Then

3) 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 ExitLoop

4) 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!

Share this post


Link to post
Share on other sites

#15 ·  Posted (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?

-Scott

Edit: Oops, 7 minutes behind CyberSlugs post ^....ditto, almost.

Edited by Scottswan

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#17 ·  Posted (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 by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

lol im such an idiot

At 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 by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

#19 ·  Posted (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 by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

Well, with the miniscule amount of information given in the timespan allotted, the answer was given in record time.


Who else would I be?

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