Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X


Error in GUI function script

autoit function GUI Include

  • Please log in to reply
4 replies to this topic

#1 jgq85



  • Active Members
  • 34 posts

Posted 28 October 2011 - 02:51 PM

I have a GUI script and setup Case with Variables and then functions for each case.
The script runs fine with no errors until I add something into this one function (for a button on the GUI that when pushed, should simply launch a website).

Not sure if I need the entire code here or if someone can identify whether I'm just unable to accomplish this within a Func / EndFunc.

Syntax Check shows no errors in the script when this portion of the script is simply:

Func _OpenDIDButton() EndFunc

But when I take that portion of the script, and add something inside of it, such as:

Func _OpenDIDButton() #include <IE.au3> _IECreate ( [$s_Url = "about:blank" [, $f_tryAttach = 0 [, $f_visible = 1 [, $f_wait = 1 [, $f_takeFocus = 1]]]]] ) EndFunc

Then I run Syntax Check and it reports:

C:\Program Files\AutoIt3\Include\WinAPIError.au3(29,1) : ERROR: syntax error

Is that referencing line 29, character 1?

Line 29 is in this portion:
While 1 $nMsg = GUIGetMsg() Switch $nMsg   Case $GUI_EVENT_CLOSE    Exit   Case $GenChecklistButton    _GenCheckListButton()   Case $EmailMgrsButton    _EmailMgrsButton()   Case $DisableADButton    _DisableADButton()   Case $OpenDIDButton    _OpenDIDButton() EndSwitch WEnd

#2 AdmiralClaws


    Where is the fish?

  • Active Members
  • PipPipPipPipPipPip
  • 4,704 posts

Posted 28 October 2011 - 03:00 PM

#include "pastes" the file where the statement is, so what you are doing here is just no going to work. You can't declare a function inside of another (just like the error said). Why are you trying that anyway?
Just move the #include to the top of your script.


Is that referencing line 29, character 1?

Something like that. Why don't you look at the two lines under that where it shows exactly where the problem is?


It's not that hard if you think logically.

Edited by AdmiralAlkex, 28 October 2011 - 03:03 PM.

#3 Melba23


    I'm old - what's your excuse?

  • Moderators
  • 22,770 posts

Posted 28 October 2011 - 03:00 PM


The #include directive adds the code at that point in the script - so you are putting all of IE.au3 inside your function. :oops:

Just add the #include line at the top of your script and see if that solves your problem. :D

StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items
GUITreeViewEx - Check/clear parent and child checkboxes in a TreeView

#4 water



  • MVPs
  • 16,444 posts

Posted 28 October 2011 - 03:03 PM

BTW: Your _IECreate statement is wrong. You inserted the syntax description.
Try something like:

Edited by water, 28 October 2011 - 03:04 PM.

Active Directory (NEW 2014-07-21 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
ADO - Wiki

#5 jgq85



  • Active Members
  • 34 posts

Posted 28 October 2011 - 03:35 PM

Thanks that works. I did try moving the # include to top, but had still left the wrong IECreate function (copy/paste from the reference website).

I do something beyond a few lines of code and start acting stupid.

Thanks again and SORRY!!!

Also tagged with one or more of these keywords: autoit, function, GUI, Include

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users