Jump to content
Sign in to follow this  
lordicast

updown function

Recommended Posts

lordicast

I need help on the updown functions for example;

Think of it as a remote control every time i press up or down on it i want it to run a function that equals a certain value automatically

EX;

channel 1 opens notepad

channel 2 opens calc

channel 3 opens cmd

any help on this would be appreciated

Edited by lordicast

[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites
smashly

Hi,

Like this maybe..

include <GUIConstants.au3>

$Gui = GUICreate(":-)", 140, 40, -1, -1, -1, $WS_EX_TOPMOST)
$Label = GUICtrlCreateLabel("", 11, 11, 99, 18, $SS_CENTER + $BS_CENTER)
GUICtrlSetBkColor(-1, 0xffffff)
$Input = GUICtrlCreateInput("", 10, 10, 120, 20, $ES_READONLY + $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0xffffff)
$UpDown = GUICtrlCreateUpdown($Input)
GUICtrlSetLimit($UpDown, 4, -1)
GUISetState(@SW_SHOW, $Gui)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $UpDown
            If StringLeft(GUICtrlRead($Input), 1) = "-"  Then
                GUICtrlSetData($Input, 3)
                GUICtrlSetData($Label, "Open CMD")
                ShellExecute("cmd.exe")
            ElseIf GUICtrlRead($Input) = 0  Then
                GUICtrlSetData($Label, "")
            ElseIf GUICtrlRead($Input) = 1 Then
                GUICtrlSetData($Label, "Open Notepad")
                ShellExecute("notepad.exe")
            ElseIf GUICtrlRead($Input) = 2 Then
                GUICtrlSetData($Label, "Open Calc")
                ShellExecute("calc.exe")
            ElseIf GUICtrlRead($Input) = 3 Then
                GUICtrlSetData($Label, "Open CMD")
                ShellExecute("cmd.exe")
            ElseIf GUICtrlRead($Input) = 4 Then
                GUICtrlSetData($Input, 0)
                GUICtrlSetData($Label, "")
            EndIf
    EndSelect
WEnd

Cheers

Edit: P.S. If your going to underline a word to give emphasis on meaning then how about spelling it correctly :)

atuomatically

automatically Edited by smashly

Share this post


Link to post
Share on other sites
lordicast

Thanks for the script however, if you are going to edit my grammar you missed appreciated but I already corrected thanks to my handy dandy spell check button ;P


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites
smashly

Your welcome :)

But I'm not the one underlining my spelling typo's ;)

Cheers

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  

×