Sign in to follow this  
Followers 0
lgodfrey

I'm missing something re functions or

3 posts in this topic

Hi Gurus of Help and Advice!

I have been humiliated :"> too many times when I think I might have found a bug to only find out that I really did not understand some syntax subtlety , so I am not going to call this one a bug, even though it has been bugging me like crazy.

Please refer to the simplified code below. I stumbled across this when I was commenting out blocks of code tring to pinpoint the syntax error.

If I run Scite syntax check, it tells me that the function SendAlert is not defined. Now, move the comment block

#cs

dummy stuff

#ce

to directly before the SendAlert function call instead of directly after it, and there is no error reported by Scite.

NOTE: if you just put in a simply comment like ";dummy stuff" instead of #cs/dummy stuff/#ce combination before the function call, you still get the syntax error.

I am at a loss. Took me hours to narrow it down this far. I am a bit uncomfortable with my understanding of dimensioning inside functions, so maybe I am doing something wrong inside SendAlert, but I do not see how that could cause this strange syntax error. But I have used this function in other code, so that doesn't seem likely.

Bottom line:

what am I doing wrong that moving the dummy comment block fixes?

Best Regards

one of the other Larrys

;Page Update and Transfer program*************************************
Opt ("MustDeclareVars", 1)      ;0=no, 1=require pre-declare        *************not default
Dim $UFSOUND = "C:\Documents and Settings\Lawrence Godfrey\My Documents\urgent.wav"
Dim $BWF = "WINDOW NOT OPEN, open it and press OK"
                                                  

SendAlert($BWF, $UFSOUND, 0)      
#cs     
dummy stuff
#ce  

Exit
;===================================================================================================

========

Func SendAlert($MSG, $SOUND, $NOTCRITICAL) ;displays MSG, plays sound, requires input from user if error
   Local $TITLE = "Book Info Transfer Script", $TIMER = 5, $RESPONDED = 0, $FLAG, $MSG, $SOUND, $NOTCRITICAL
   SoundSetWaveVolume(100)
   If $NOTCRITICAL Then
      $FLAG = 64
   Else
      $FLAG = 48
   EndIf
   
   SoundPlay($SOUND, 1) 
   $RESPONDED = MsgBox($FLAG, $TITLE, $MSG, $TIMER)
   
   If $NOTCRITICAL Then ;iF NOT critical, then go back after box has timed out or user acknowledged info
      SoundSetWaveVolume(20) 
      Return
   EndIf
   
   While $RESPONDED = -1 ;critical, so keep bugging user until box OK button is pushed.
      SoundPlay($SOUND, 1) 
      $RESPONDED = MsgBox($FLAG, $TITLE, $MSG, $TIMER)
   Wend
   SoundSetWaveVolume(20)
EndFunc  ;==>SendAlert

I'm, Lovin' IT, X

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Larry,

It seems that you're using an old version of Au3check created by Tylo (thanks Tylo!) that came with the Scite installer. I had Au3check v1.00 and was able to recreate your error. I upgraded to latest version of Au3check to v1.12, and the error went away. You can download the latest version of Au3check from here:

http://www.autoitscript.com/forum/index.php?showtopic=3169

Or you can download the latest version of Scite installer created by JdeB (thanks JdeB!) from here:

http://www.autoitscript.com/forum/index.php?showtopic=3802

Hope this helps!

=MX=

Edited by midiaxe

Share this post


Link to post
Share on other sites

so my Scite was old and out of date, just like me!

This fixed it, thanks so much

Larry


I'm, Lovin' IT, X

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