Jump to content

syntax error?


Recommended Posts

If $include2 <> "" Then

If $include2 <> 0 Then FileChangeDir ( StringReplace ( $result2, "\Misc.au3", "" ) )

Else notify ( "au3 Checkup could not locate your autoit3 include directory. Aborting..." )

Else

notify ( "au3 Checkup could not locate your autoit3 include directory. Aborting..." )

EndIf

Func notify($text)

$abort = StringinStr ( $text, "abort" )

If $abort <> 0 Then Exit

If @OSTYPE = "WIN32_NT" Then

TrayTip ( "au3 Checkup", $text, 15 )

Else

MsgBox ( 64, "au3 Checkup", $text & @CRLF & @CRLF & "Click OK to continue." )

EndIf

EndFunc

it says theres in error for the line in red. doesnt tell me what error, just ... "syntax error"

whats wrong with my script?

- Matt :whistle:

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

is this what you meant to do?

If $include2 <> "" Then
    If $include2 <> 0 Then
        FileChangeDir(StringReplace($result2, "\Misc.au3", ""))
    Else
        notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
EndIf
Func notify($text)
    $abort = StringInStr($text, "abort")
    If $abort <> 0 Then Exit
    If @OSTYPE = "WIN32_NT" Then
        TrayTip("au3 Checkup", $text, 15)
    Else
        MsgBox(64, "au3 Checkup", $text & @CRLF & @CRLF & "Click OK to continue.")
    EndIf
EndFunc  ;==>notify

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

actually, theres more code between them, i just posted the important stuff. heres the full script:

#region check files
notify ( "au3 checkup will now search your drive for the required include files. Please be patient, as this may take a few minutes." )
runWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\Misc.au3 > "' & @TempDir & '\au3CheckupResult.txt"', @HomeDrive, @SW_SHOW)
WinWaitClose ( @HomeDrive & "\WINDOWS\system32\cmd.exe" )
$file = FileOpen ( @TempDir & "\result.txt", 0 )
$result = FileReadLine ( $file )
$result2 = FileReadLine ( $file )
$include = StringInStr ( $result, "\include\" )
$include2 = ""
If $include2 <> "" Then
    If $include2 <> 0 Then
        FileChangeDir(StringReplace($result2, "\Misc.au3", ""))
    Else
        notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
EndIf
If $include2 <> "" Then
    If $include2 <> 0 Then FileChangeDir ( StringReplace ( $result2, "\Misc.au3", "" ) )
    Else notify ( "au3 Checkup could not locate your autoit3 include directory. Aborting..." )
Else
    notify ( "au3 Checkup could not locate your autoit3 include directory. Aborting..." )
EndIf
#endregion

Func notify($text)
    $abort = StringInStr($text, "abort")
    If $abort <> 0 Then Exit
    If @OSTYPE = "WIN32_NT" Then
        TrayTip("au3 Checkup", $text, 15)
    Else
        MsgBox(64, "au3 Checkup", $text & @CRLF & @CRLF & "Click OK to continue.")
    EndIf
EndFunc

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

not sure why you would have the same if block twice but okay.

#region check files
notify("au3 checkup will now search your drive for the required include files. Please be patient, as this may take a few minutes.")
RunWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\Misc.au3 > "' & @TempDir & '\au3CheckupResult.txt"', @HomeDrive, @SW_SHOW)
WinWaitClose(@HomeDrive & "\WINDOWS\system32\cmd.exe")
$file = FileOpen(@TempDir & "\result.txt", 0)
$result = FileReadLine($file)
$result2 = FileReadLine($file)
$include = StringInStr($result, "\include\")
$include2 = ""
If $include2 <> "" Then
    If $include2 <> 0 Then
        FileChangeDir(StringReplace($result2, "\Misc.au3", ""))
    Else
        notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
EndIf
If $include2 <> "" Then
    If $include2 <> 0 Then 
        FileChangeDir(StringReplace($result2, "\Misc.au3", ""))
    Else 
        notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
EndIf
#endregion

Func notify($text)
    $abort = StringInStr($text, "abort")
    If $abort <> 0 Then Exit
    If @OSTYPE = "WIN32_NT" Then
        TrayTip("au3 Checkup", $text, 15)
    Else
        MsgBox(64, "au3 Checkup", $text & @CRLF & @CRLF & "Click OK to continue.")
    EndIf
EndFunc  ;==>notify

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

ok...i dont get any more errors, but the first "notify" shows for almost no time at all, then the program exits.

#region check files
notify("au3 checkup will now search your drive for the required include files. Please be patient, as this may take a few minutes.")
RunWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\Misc.au3 > "' & @TempDir & '\au3CheckupResult.txt"', @HomeDrive, @SW_HIDE)
$file = FileOpen(@TempDir & "\result.txt", 0)
$result = FileReadLine($file)
$result2 = FileReadLine($file)
$include = StringInStr($result, "\include\")
$include2 = ""
If $include <> "" Then
    If $include <> 0 Then
        FileChangeDir(StringReplace($result, "\Misc.au3", ""))
    Else
        notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
        Exit
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
    Exit
EndIf
If $include2 <> "" Then
    If $include2 <> 0 Then
        FileChangeDir(StringReplace($result2, "\Misc.au3", ""))
    Else
        notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
        Exit
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory. Aborting...")
    Exit
EndIf
MsgBox ( 0, "test", @WorkingDir )
#endregion

Func notify($text)
    If @OSTYPE = "WIN32_NT" Then
        TrayTip("au3 Checkup", $text, 15)
    Else
        MsgBox(64, "au3 Checkup", $text & @CRLF & @CRLF & "Click OK to continue.")
    EndIf
EndFunc

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

heres my script so far...

#region check files
notify("au3 checkup will now search your drive for the required include files. Please be patient, as this may take a few minutes.")
RunWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\Misc.au3 > "' & @TempDir & '\au3CheckupResult.txt"', @HomeDrive, @SW_HIDE)
$file = FileOpen(@TempDir & "\result.txt", 0)
$result = FileReadLine($file)
$result2 = FileReadLine($file)
$include = StringInStr($result, "\include\")
$include2 = ""
If $include <> "" Then
    If $include <> 0 Then
        FileChangeDir(StringReplace($result, "\Misc.au3", ""))
    Else
        notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
        Sleep ( 15000 )
        Exit
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
    Sleep ( 15000 )
    Exit
EndIf
If $include2 <> "" Then
    If $include2 <> 0 Then
        FileChangeDir(StringReplace($result2, "\Misc.au3", ""))
    Else
        notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
        Sleep ( 15000 )
        Exit
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
    Sleep ( 15000 )
    Exit
EndIf
MsgBox ( 0, "test", @WorkingDir )
#endregion

Func notify($text)
    If @OSTYPE = "WIN32_NT" Then
        TrayTip("au3 Checkup", $text, 10)
    Else
        MsgBox(64, "au3 Checkup", $text & @CRLF & @CRLF & "Click OK to continue.")
    EndIf
    Sleep ( 500 )
EndFunc

for some reason, it cant locate my include directory. i just get the "au3 Checkup could not locate your autoit3 include directory" error...any ideas?

- Matt :whistle:

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

#region check files
notify("au3 checkup will now search your drive for the required include files. Please be patient, as this may take a few minutes.")
RunWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\Misc.au3 > ' & @TempDir & '\au3CheckupResult.txt', @HomeDrive, @SW_HIDE)
$file = FileOpen(@TempDir & "\au3CheckupResult.txt", 0)
$result = FileReadLine($file)
$result2 = FileReadLine($file)
FileClose($file)
$include = StringInStr($result, "\include\")
$include2 = ""
If $include <> "" Then
    If $include <> 0 Then
        FileChangeDir(StringReplace($result, "\Misc.au3", ""))
          notify("Found include folder at: " & $result)
    Else
        notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
        Sleep ( 15000 )
        Exit
    EndIf
Else
    notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
    Sleep ( 15000 )
    Exit
EndIf
;~ If $include2 <> "" Then
;~   If $include2 <> 0 Then
;~       FileChangeDir(StringReplace($result2, "\Misc.au3", ""))
;~   Else
;~       notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
;~       Sleep ( 15000 )
;~       Exit
;~   EndIf
;~ Else
;~   notify("au3 Checkup could not locate your autoit3 include directory." & @CRLF & "Aborting...")
;~   Sleep ( 15000 )
;~   Exit
;~ EndIf
MsgBox ( 0, "test", @WorkingDir )
#endregion

Func notify($text)
    If @OSTYPE = "WIN32_NT" Then
        TrayTip("au3 Checkup", $text, 10)
    Else
        MsgBox(64, "au3 Checkup", $text & @CRLF & @CRLF & "Click OK to continue.")
    EndIf
    Sleep ( 500 )
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

<sarcasm>

I guess AutoIt doesn't have a well defined algorithm for locating files for an #include directive, that just makes too much sense. And I doubt the author of such an algorithm would ever post that information, anyway, so searching the forum is obviously not going to be very productive. Especially if you then try to filter by my user name. It's not like I wrote that code or anything.

</sarcasm>

Seriously. Has it not occurred to anybody that searching the entire hard drive is kind of dumb when it's obvious that AutoIt has some sort of search pattern it uses? Doesn't it make more sense to:

  • Find out the search pattern and emulate it.
  • Failing above, just ask the user where the file is instead of wasting time searching the entire hard drive.
Just because somebody gave one possible idea does not mean that idea is the one that should be first explored.
Link to comment
Share on other sites

  • Moderators

Just because somebody gave one possible idea does not mean that idea is the one that should be first explored.

Nor, does it mean it should be the last...

Seriously.  Has it not occurred to anybody that searching the entire hard drive is kind of dumb

Funny I saw this tonight, after speaking with my 6 yr old son. He say's "Dad, why do I need to "Read", I just let everyone tell me what they've read, and "Wing it", "My imagination is much better than what they've read anyway". (Um probably my fault).

Son, What is the first letter of the Alphabet?, He replies... ("What language") hmm Sternly I say... ("American", so that he doesn't try to be a smart azz again) Native or Proper he says.... OMG!!!

Point?... We can AssUMe that eveyone has had the education that you/he/ or she has, and wonder why someone should take a path they've chosen. Or we could embrase the situation, and 'think' for a second.. maybe they haven't quite had that luxury. Maybe they haven't had the 'Teachers' you/he/ or she have/has.

Let me ask you this.... Would you tell you're 6 yr old child... It was "dumb", or would you rather explain the reason he shouldn't take the path he/she is taking and encourage them to seek further? For God's sake and yours, I hope you're answer is the latter.

Not a stab at you Valik, I respect you totally, and you're ability (I still use your semaphore with every script I write). But it is a stab at your One Minute Management Skills (Ken Blanchard I believe).

As a developer, you are looked upon for encouragement to exceed, not discouragment to recede.

I understand that some were born w/ a silver processor in their mouths, and the ability to over come all. But people like myself, that just want to learn... that want to embrace the excellence of knowledge such as your own, really find it hard to take a step forward, when we've been slapped 2 steps back.

Now, I know, reading your many posts, that you will have some elongated explination of why it is that "idiot's", "degenerates", or "Un-Hopefulls", should not be posting such silly and non-educated questions. And for that, I'm glad you didn't get to my posts before the Larry's and Cyberslug's did. However educated your responses might be, I must tell you that the tact that you use is like being back on the kindergarten play ground, only now it's your turn to fight back.

I know, I'm only opening myself up to criticism, by you and or your peers. But, I felt obligated by a 6yr old boy to say what I was thinking.

I know your personification will probably (hopefully not, I'm not intellectually known for this kind of conversation) make you respond to this in a rebellious way, but I only hope you learn now before later, that not everyone needs and or deserves ridicule.

EDIT: I can understand these types of comments to a point in the Idea lab or the Scripts and Scraps... and especially the Dev's forum... But I made this comment specifically because this is the "Support" Forum.

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

We're not talking computer science here. We're talking basic common sense. Does it make sense for AutoIt to do a full recursive drive search to find the location of files for #include? Can anybody sitting out there honestly say that makes sense? I'm not asking anybody to write a full-fledged specification compliant DOM based XML parser, I'm just asking people to engage their brain for 2 seconds and think. Are you trying to tell me that I was born with the special ability that very few others have? The ability to think?

Link to comment
Share on other sites

We're not talking computer science here.  We're talking basic common sense.  Does it make sense for AutoIt to do a full recursive drive search to find the location of files for #include?  Can anybody sitting out there honestly say that makes sense?  I'm not asking anybody to write a full-fledged specification compliant DOM based XML parser, I'm just asking people to engage their brain for 2 seconds and think.  Are you trying to tell me that I was born with the special ability that very few others have?  The ability to think?

<{POST_SNAPBACK}>

Valik

First off, I'm not trying to start a fight or anything, just point out a wrong doing.

The ability to think is not limited to one method. For example, your thought process eliminates paths. Much like lightning, you chose the path of least resistance (in this case, code vs. CPU time). This person on the other-hand is taking the path of most resistance to ensure that it works. The key is not to try and change another person's point of view on a problem, but instead offer advice that you may, or may not, feel they need.

What many programmers often forget is that coding is more about compromise than anything else. Should I compromise user-friendliness for speed or vice versa? Should I hard-code things I don't expect to vary from machine to machine or not? This is more common in multiplatform applications and games, but that does not invalidate the statements above in any way.

To sum it all up: As you were saying about thinking, maybe you should take your own advice and apply it. Think before you act.

theguy0000:

Just a suggestion, but why not create a txt file of common filenames for includes? You could also just do a search on the hard-drive for any folder named "include" and then begin your file checking (thus saving you some time and eliminating false positives).

-CMR

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...