Sign in to follow this  
Followers 0
jgq85

Error in GUI function script

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by AdmiralAlkex

Share this post


Link to post
Share on other sites

jgq85,

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Try something like:

_IECreate("www.google.com")
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2015-10-12 - Version 1.4.3.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-01-07 - Version 1.1.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

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

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

  • Similar Content

    • TheDcoder
      Help with resizing controls in a resizable window!
      By TheDcoder
      Hello! I am trying make my GUI Controls resize correctly... Here is my GUI's code:
      #include <ButtonConstants.au3> #include <ColorConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> Global $g_hMainGUI = GUICreate("Test GUI", 500, 316, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetBkColor($COLOR_WHITE, $g_hMainGUI) GUICtrlCreateGroup("Box 1", 6, 2, 488, 197) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateLabel("Label", 9, 20, 67, 15) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateCombo("", 77, 14, 334, 21, $CBS_DROPDOWNLIST) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateButton("Button 0", 415, 13, 74, 23) GUICtrlSetResizing(-1, BitOR($GUI_DOCKAUTO, $GUI_DOCKVCENTER, $GUI_DOCKHEIGHT)) GUICtrlCreatelistView("Col 1|Col 2|Col 3", 12, 42, 476, 149, $LVS_SINGLESEL, BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE)) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateGroup("Box 2", 6, 199, 253, 112) ;GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) GUICtrlCreateButton("Button 1", 11, 214, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 2", 11, 245, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 3", 133, 245, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 4", 133, 214, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 5", 11, 276, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 6", 133, 276, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateGroup("Box 3", 264, 199, 230, 112) ;GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) GUICtrlCreateButton("Button 7", 269, 214, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 8", 269, 245, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 9", 269, 276, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUISetState() Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($g_hMainGUI) Here is what I need: 

      1. Prevent button 0, Label & Combo from moving down
      2. Prevent expansion of Box 1 & 2
       
      I tried a lot but I can't get the desired result, now my brain hurts!
      Thanks in Advance, TD!
    • Valnurat
      Retrieve data from Array
      By Valnurat
      Hi.
      How is it possible to retrieve data from an array by searching in the array?
      I want to retrieve data from col0 by searching in col1.
      Func _MisPlacedAD_Accounts() _ArrayDisplay($aAllBackupDestination,"AllBackupDestination") _ArrayDisplay($aMisPlacedAD_Accounts,"Before delete") _ArrayDisplay($aUsersTarget,"UsersTarget") Local $aListOfFolders, $sIndex for $y = 0 to UBound($aAllBackupDestination) -1 $aListOfFolders = _FileListToArray($aAllBackupDestination[$y][0],Default,2,False) for $z = UBound($aMisPlacedAD_Accounts) -1 to 0 Step -1 If _ArrayFindAll($aListOfFolders,$aMisPlacedAD_Accounts[$z]) <> -1 Then $sIndex = _ArrayFindAll($aUsersTarget,$aMisPlacedAD_Accounts[$z],Default,Default,Default,Default,3) ;_ArrayDisplay($aMisPlacedAD_Accounts,"Before delete") MsgBox($MB_SYSTEMMODAL, $aMisPlacedAD_Accounts[$z], UBound($sIndex)) _ArrayDelete($aMisPlacedAD_Accounts,$z) ;_ArrayDisplay($aMisPlacedAD_Accounts,"After delete") EndIf Next Next _ArrayDisplay($aMisPlacedAD_Accounts,"After delete") EndFunc In this case $sIndex is allways 1.
    • Akashrai
      Auto it script is not running after closing session
      By Akashrai
      Hi,
      I have written a script in autoit for automation. It is scheduled and running on server but i have noticed it stops at some points. But when i am taking remote of server and running it runs fine. Is it problem of winActivate() or winWaitActivate() or any other method which i am using, is only run when screen is activated? If this is the may i get list of those methods and alternative of the same. I need alternative of winActivate() and winWaitActivate() methods. Any document or link is welcome. Please help ...       
      thick.au3
    • Valnurat
      Read details from a file
      By Valnurat
      Is there an option to read the details of a file?
      Like the owner of a file?
    • Valnurat
      Decrease records in array
      By Valnurat
      I would like to decrease the number of records to make my search for folders quicker, but how is it possible.
      If I just use _ArrayDelete function I messup my 1st for..to..next.
      Func _MisPlacedAD_Accounts() _ArrayDisplay($aAllBackupDestination,"AllBackupDestination") _ArrayDisplay($aMisPlacedAD_Accounts,"Before delete") Local $aListOfFolders for $y = 0 to UBound($aAllBackupDestination) -1 $aListOfFolders = _FileListToArray($aAllBackupDestination[$y][0],Default,2,False) for $z = 0 to UBound($aMisPlacedAD_Accounts) -1 If _ArrayFindAll($aListOfFolders,$aMisPlacedAD_Accounts[$z]) <> -1 Then _ArrayDelete($aMisPlacedAD_Accounts,$z) EndIf Next Next _ArrayDisplay($aMisPlacedAD_Accounts,"After delete") EndFunc