Sign in to follow this  
Followers 0
PantZ4

@GUI_CtrlId Unknown macro?

3 posts in this topic

So I keep getting a unknown macro error on @GUI_CtrlId.

>"C:\Programmer\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\HP_Ejer\Skrivebord\AutoIt\Wallpaper changer\Src\include\_GUICreate_Settings.au3" /autoit3dir "C:\Programmer\AutoIt3" /UserParams    
+>10:44:10 Starting AutoIt3Wrapper v.1.10.1.8   Environment(Language:0406  Keyboard:00000406  OS:WIN_XP/Service Pack 2  CPU:X86)
>Running AU3Check (1.54.13.0)  from:C:\Programmer\AutoIt3
+>10:44:10 AU3Check ended.rc:0
>Running:(3.2.12.0):C:\Programmer\AutoIt3\autoit3.exe "C:\Documents and Settings\HP_Ejer\Skrivebord\AutoIt\Wallpaper changer\Src\include\_GUICreate_Settings.au3"   

C:\Documents and Settings\HP_Ejer\Skrivebord\AutoIt\Wallpaper changer\Src\include\_GUICreate_Settings.au3 (355) : ==> Unknown macro.:
If @GUI_CtrlId = $GS_Apply Then
If ^ ERROR

->10:44:11 AutoIT3.exe ended.rc:1
>Exit code: 1   Time: 1.800

The function:

; #FUNCTION# ===============================================================================
; Name...........: _GUICtrlSetState_Apply
; Description ...: Set the state of the apply button
; Syntax.........: _GUICtrlSetState_Apply()
; Parameters ....: None
; Return values .: 0
; Author ........: Mr. Zero
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; No
; ===========================================================================================
Func _GUICtrlSetState_Apply()
    
; If the pressed control were the Apply button
    If @GUI_CtrlId = $GS_Apply Then
        
    ; Then set it to disabled
        GUICtrlSetState($GS_Apply, $GUI_DISABLE)
        
    ; And write to settings file
        _IniWrite_Settings()
        
; Else if Apply button is already disabled
    ElseIf BitAND(GUICtrlGetState($GS_Apply), $GUI_DISABLE) Then
        
    ; Then enable it
        GUICtrlSetState($GS_Apply, $GUI_ENABLE)
        
; End
    EndIf
    
EndFunc  ;==>_GUICtrlSetState_Apply

Any idea why I get this error?

Share this post


Link to post
Share on other sites



So I keep getting a unknown macro error on @GUI_CtrlId.

First you must be in OnEvent mode using

Opt("GUIOnEventMode",1)

Then the function _GUICtrlSetState_Apply must have been set as the function to call when an event occurs

GuiCtrlSetOnEvent($SomeControl," _GUICtrlSetState_Apply")

$Gui_CtrlID is set to be the last clicked control so if the function is called before anything is clicked it won't have been set.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

First you must be in OnEvent mode using

Opt("GUIOnEventMode",1)

Then the function _GUICtrlSetState_Apply must have been set as the function to call when an event occurs

GuiCtrlSetOnEvent($SomeControl," _GUICtrlSetState_Apply")

$Gui_CtrlID is set to be the last clicked control so if the function is called before anything is clicked it won't have been set.

Of course I have done this already. Sorry for not have written this in the first post.

Even if I hadn't done GUIOnEventMode, I should still be able to run the script right? The macro would just return 0.

Opt("GUIOnEventMode", 1)

; Apply
    Local $GS_Apply_T = IniRead($APPLANGFILE, $APPLANG, $GS_Apply_KEY, $GS_Apply_DEF)
    Global $GS_Apply = GUICtrlCreateButton($GS_Apply_T, $GS_Apply_X, $GS_Apply_Y, $GS_Apply_W, $GS_Apply_H, $GS_Apply_S, $GS_Apply_ExS)
    GUICtrlSetOnEvent(-1, "_GUICtrlSetState_Apply")

EDIT: Nevermind founded the error. One of the setup functions were linking to it without a control input.

Edited by Mr. Zero

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