Sign in to follow this  
Followers 0
thewind27

I need help with GUICreateButton

4 posts in this topic

I created a GUI with combobox and button

In the combobox I have 6 values

Now I want to everytime the form starts, the GUI let me choose 1 of 6 values then when i press the button, I will send keys to another windows (my case is chrome or firefox)

Here is the code that I have for now.

Group ()
Func Group()
GUICreate("iSwitch",200,100,700,200)
GUICtrlCreateLabel("Please choose:", 10, 10, 100, 20)
GUICtrlCreateCombo("BUDGET", 50, 30, 100,90)
GUICtrlSetData(-1, "MTI|NEW PHONE|TERRACOM|TSB|YOURTEL")
GUICtrlCreateButton("Switch", 50, 60, 100, 25)
GUISetState()
Sleep(1000); Allow 1 second to see the GUI.
EndFunc

Share this post


Link to post
Share on other sites



Lets see if i get it, you want to choose one option from the drop down list, and then when you press the button "Switch" to happen.. what?


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Just when I press Switch it will do the series of thing that I want (basically just perform alt+tab to switch to the next windows, then send mouse click at a point to activate the input box, then send the keys I want)

for example: when i choose "MTI" from the combobox, it will switch to the next windows and Send("MTI") to an input box.

Thanks

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Maybe some of this:

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
Opt("MustDeclareVars", 1);enabled
Global $hGUI, $Msg, $bSwitch, $cBUDGET;declare global variables
$hGUI = GUICreate("iSwitch", 200, 100, 700, 200)
GUICtrlCreateLabel("Please choose:", 10, 10, 100, 20)
$cBUDGET = GUICtrlCreateCombo("", 50, 30, 100, 90);<<<<<removed BUDGET or would be a value in drop down list
GUICtrlSetData(-1, "MTI|NEW PHONE|TERRACOM|TSB|YOURTEL","MTI")
;##====================================================^========sets default value
$bSwitch = GUICtrlCreateButton("Switch", 50, 60, 100, 25)
GUISetState()
While 1
$Msg = GUIGetMsg()
Switch $Msg
  Case $GUI_EVENT_CLOSE
   __MyExit()
   Exit
  Case $bSwitch; if $Msg = $bSwitch
   __SwitchFunc()
EndSwitch
WEnd
Func __SwitchFunc()
Local $crBUDGET
$crBUDGET = GUICtrlRead($cBUDGET)
If $crBUDGET = "MTI" Then MsgBox(0, "You Selected MTI", "ITem Index:  " & _GUICtrlComboBox_GetCurSel($cBUDGET))
;##======================^=========put code or call next Function here  ^==========retreives cursor index
If $crBUDGET = "NEW PHONE" Then
  MsgBox(0, "You Selected NEW PHONE", "ITem Index:  " & _GUICtrlComboBox_GetCurSel($cBUDGET))
  ;##========to do additional work, structure like this (If/EndIf)
EndIf
If _GUICtrlComboBox_GetCurSel($cBUDGET) = 2 Then MsgBox(0, "You Selected TERRACOM", "ITem Index:  " & _GUICtrlComboBox_GetCurSel($cBUDGET))
EndFunc   ;==>__SwitchFunc
Func __MyExit()
GUIDelete($hGUI)
Exit
EndFunc   ;==>__MyExit
Edited by SupaNewb

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