Gamer Posted October 31, 2006 Share Posted October 31, 2006 Hello all I am new here and I am also learning this wonderful scripting language. However I cant figure out on how to make it so you can click a button and have it show something. Here is part of my code: if (MouseClick("Left") Then MsgBox(0,"Program","Wow nice click!!!") EndIf ;Create A button GUICtrlCreateButton("Click Here!,0,0) I also tried using a variable did not work. Can someone help me? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 31, 2006 Moderators Share Posted October 31, 2006 Hello all I am new here and I am also learning this wonderful scripting language.However I cant figure out on how to make it so you can click a button and have it show something.Here is part of my code:if (MouseClick("Left") Then MsgBox(0,"Program","Wow nice click!!!")EndIf;Create A buttonGUICtrlCreateButton("Click Here!,0,0)I also tried using a variable did not work.Can someone help me?Hi, if you are using AutoIt 3.2.0.1 and above, then take a look at _IsPressed() in the help file. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
crystalburner Posted October 31, 2006 Share Posted October 31, 2006 What is the cokey? The cokey is incorrect, the correct terminology is "The Sm0key cokey" like this Func thesmokey($cokey) Whoa 1 $the="Sm0key Cokey" wend Whoa 1 $the="The Sm0key Cokey" wend Endfunc You can call this function as many times as you like, its best run at night after a few drinks Link to comment Share on other sites More sharing options...
crystalburner Posted November 1, 2006 Share Posted November 1, 2006 Sorry for the sillyness from the help file expandcollapse popup; A simple custom messagebox that uses the OnEvent mode #include <GUIConstants.au3> Opt("GUIOnEventMode",1) GUICreate("Custom Msgbox", 210, 80) $Label = GUICtrlCreateLabel("Please click a button!", 10, 10) $YesID = GUICtrlCreateButton("Yes", 10, 50, 50, 20) GUICtrlSetOnEvent($YesID,"OnYes") $NoID = GUICtrlCreateButton("No", 80, 50, 50, 20) GUICtrlSetOnEvent($NoID,"OnNo") $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20) GUICtrlSetOnEvent($ExitID,"OnExit") GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit") GUISetState() ; display the GUI While 1 Sleep (1000) WEnd ;--------------- Functions --------------- Func OnYes() MsgBox(0,"You clicked on", "Yes") EndFunc Func OnNo() MsgBox(0,"You clicked on", "No") EndFunc Func OnExit() if @GUI_CtrlId = $ExitId Then MsgBox(0,"You clicked on", "Exit") Else MsgBox(0,"You clicked on", "Close") EndIf Exit EndFunc Link to comment Share on other sites More sharing options...
cppman Posted November 1, 2006 Share Posted November 1, 2006 (edited) Ben.. here is something, maybe, a little bit easier for you. GUICreate("Test") $button = GUICtrlCreateButton("testing", 0, 0, 100) GUISetState() while (1) sleep(10) if (GUIGetMSg() == -3) then Exit if (GUIGetMsg() == $button) then MsgBox(0, "", "Nice Click!") wend Edited November 1, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
crystalburner Posted November 1, 2006 Share Posted November 1, 2006 Or could do something even easier i spose, bit basic but would work for a yes, no situation No includes required. $clickme=msgbox(262148,'','Clickme') if $clickme=6 then msgbox(262144,'You clicked','YES') Else msgbox(262144,'You clicked','NO') EndIf Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 2, 2006 Moderators Share Posted November 2, 2006 Ben.. here is something, maybe, a little bit easier for you. GUICreate("Test") $button = GUICtrlCreateButton("testing", 0, 0, 100) GUISetState() while (1) sleep(10) if (GUIGetMSg() == -3) then Exit if (GUIGetMsg() == $button) then MsgBox(0, "", "Nice Click!") wend oÝ÷ Ûú®¢×,(ºWr¢êhQ g2È,¢f§ÊئzÆ®¶sduT7&VFRgV÷CµFW7BgV÷C²¢b33c¶'WGFöâÒuT7G&Ä7&VFT'WGFöâgV÷C·FW7FærgV÷C²Â¤uT6WE7FFR¥vÆR¢7vF6uTvWD×6r¢66RÒ0¢W@¢66Rb33c¶'WGFöà¢×6t&÷Âb33²b33²Âb33´æ6R6Æ6²b333²b33²¢VæE7vF6¥tVæoÝ÷ Ú«¨µéÚoÝ÷ Ù«¢+Ø)%µÍ½à ÈØÈÄÐà°ÌäìÌäì°Ìäí ±¥µÌäì¤ôØQ¡¸(µÍ½à ÈØÈÄÐаÌäíe½Ô±¥Ìäì°ÌäíeLÌäì¤)±Í(µÍ½à ÈØÈÄÐаÌäíe½Ô±¥Ìäì°Ìäí9Are a couple. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
crystalburner Posted November 2, 2006 Share Posted November 2, 2006 I'm out of my league now, Sm0ke is to me an absolute genius with AutoIT, so I'd say all points go to him on this one. Link to comment Share on other sites More sharing options...
crystalburner Posted November 2, 2006 Share Posted November 2, 2006 I lied! This does what you originally asked for with just one line of code if msgbox(262144,'','Clickme') = 1 then msgbox(262144,'Hey','Nice click!') 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