Sign in to follow this  
Followers 0
MariusN

Variable inside function?

4 posts in this topic

#1 ·  Posted (edited)

Hope someone can help me on this one...

The "$input" does not show up in my function :mellow:

$input = InputBox("My number! ", "Please Enter time-delay ", _
        "numbers only! (Default = 60)", " M4", 270, 130)


_message()
Func _message()
    Local $input, $font
    $font = "Times New Roman"

    GUICreate("Timer Settings", 330, 100)
    GUICtrlCreateLabel("Timer set to an interval of ",10,30,250)
    GUICtrlSetFont(-1, 14, 800, 0, $font)
    GUICtrlCreateLabel($input,220, 30,-1);<----THIS DOES NOT SHOW
    GUICtrlSetFont(-1, 14, 800, 0, $font)
        GUICtrlSetColor(-1, 0x3333FF)
    GUICtrlCreateLabel("seconds",245,30,60)
    gUICtrlSetFont(-1, 14, 800, 0, $font)

    GUISetState()

    While 1
        Sleep(2000)
        Exit
    WEnd


EndFunc   ;=
Edited by MariusN

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

You have declared $input inside your function so it will be a different variable (local to that function only), initially set to ''. Remove that declaration and it will work.

To make it more obvious you could have

Global $input
$input = InputBox(....

EDIT: Too slow.

Edited by martin

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

Eish man...You guys are hero's....thx a bunch :mellow:

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