Jump to content

Recommended Posts

Posted

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?

  • Moderators
Posted

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?

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.

Posted

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

Posted

Sorry for the sillyness

from the help file

; 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
Posted

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
  • Moderators
Posted

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 g­2È,¢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½Ô±¥­Ìäì°Ìäí9
Are 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.

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
×
×
  • Create New...