Sign in to follow this  
Followers 0
Gamer

Clicking Help

9 posts in this topic

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?

Share this post


Link to post
Share on other sites



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.

[center]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.[/center]

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

[center]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.[/center]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!')

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