jgq85 Posted October 28, 2011 Posted October 28, 2011 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 Func ^ 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
AdmiralAlkex Posted October 28, 2011 Posted October 28, 2011 (edited) #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. Edit: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?Func^ It's not that hard if you think logically. Edited October 28, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Moderators Melba23 Posted October 28, 2011 Moderators Posted October 28, 2011 jgq85,The #include directive adds the code at that point in the script - so you are putting all of IE.au3 inside your function. Just add the #include line at the top of your script and see if that solves your problem. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
water Posted October 28, 2011 Posted October 28, 2011 (edited) BTW: Your _IECreate statement is wrong. You inserted the syntax description. Try something like: _IECreate("www.google.com") Edited October 28, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
jgq85 Posted October 28, 2011 Author Posted October 28, 2011 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!!!
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