Sign in to follow this  
Followers 0
cxzzD

GUI Button Call function?

17 posts in this topic

So I was wondering if it's possible to make my $button1 start a functin when it's pressed?

So, basicly I got a whole lot of code, but I do not have an GUI for it. So I decided to create a GUI for it, but now I do not know how to make my Button actually execute the script.

Here is the GUI code:

#include <NomadMemory.au3>

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 625, 443, 192, 124)

$Label1 = GUICtrlCreateLabel("Label1", 8, 32, 84, 25)

$Label2 = GUICtrlCreateLabel("Label2", 8, 104, 84, 33)

$Button1 = GUICtrlCreateButton("Start Bot", 8, 360, 257, 57, $WS_GROUP)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

After this I created a "func _start()" right before my code, and right after I put EndFunc, so how do I start the "_start()" function by pressing the button on my GUI? :x

Thanks in advance. If anything was hard to understand,just say, and ill try to elaborate. Was quite hard to explain this when I do not really know what everything is called :P

Share this post


Link to post
Share on other sites



xCynic,

Start Bot

Please read this. :P

The answer to your question can be found on the <GUI Reference - MessageLoop Mode> page of the Help file. You might find the excellent tutorials that you will find here and here useful as well. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

xCynic,

Please read this. :shifty:

The answer to your question can be found on the <GUI Reference - MessageLoop Mode> page of the Help file. You might find the excellent tutorials that you will find here and here useful as well. :x

M23

The bot dosn't necessarily have to be for an online game now does it? :P

Thanks for your answer tho ^^

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _Start()
    EndSwitch
WEnd

Thanks, ill try it, got no clue what it does tho :3

EDIT: Awesome, it worked. <3

Edited by xCynic

Share this post


Link to post
Share on other sites

Good luck with that Microsoft Word bot you were working on :x

Share this post


Link to post
Share on other sites

Good luck with that Microsoft Word bot you were working on :x

Actually it's a friend of mine who requested me to create a spam bot for him (MSN). Nudge spam, Message Spam, and to Steal the other persons information (your MSN status will be the exact same as the other persons), allthough, I don't think I'm able to do the last one just yet.

Share this post


Link to post
Share on other sites

Got a new problem now tho. Is there anyway to check if a certain process is running? I got this "WinWaitActive", but I want it to clearly state on the *bot* if the process is not running. Like "Waiting for MSN to start" and when the program finds MSN's process this text will dissapear?

Share this post


Link to post
Share on other sites

Actually it's a friend of mine who requested me to create a spam bot for him (MSN). Nudge spam, Message Spam, and to Steal the other persons information (your MSN status will be the exact same as the other persons), allthough, I don't think I'm able to do the last one just yet.

In the Name of all that is Holy, please NEVER say anything like that on a public forum again. You are inviting a world of hurt on yourself!!!!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

In the Name of all that is Holy, please NEVER say anything like that on a public forum again. You are inviting a world of hurt on yourself!!!!

Did not know that a MSN *bot* was against the rules. In that case, it won't happen again..

Just out of curiosity, why is this against the rules(?), all I'm trying to do here is learn the language :3 + Can't come up with a good idea for a script to make, seems quite lame to create a script that opens Chrome and searches for something random ;o

+In the announcement, it was only stated that one may not talk about automating games. And in my head, MSN isn't really a game, is it? :x

Edited by xCynic

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Did not know that a MSN *bot* was against the rules. In that case, it won't happen again..

Just out of curiosity, why is this against the rules(?), all I'm trying to do here is learn the language :3 + Can't come up with a good idea for a script to make, seems quite lame to create a script that opens Chrome and searches for something random ;o

Yea right, you are just stupid and can't think of any reason why we do not want any of this shit discussed here?

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Steal the other persons information (your MSN status will be the exact same as the other persons)

That part may be considered criminal impersonation, keyword "criminal", aka identity theft

Share this post


Link to post
Share on other sites

Yea right, you are just stupid and can't think of any reason why we do not want any of this shit discussed here?

Jos

Temper FTW. Would have been better if you just told me that it's against the rules, but no.. Here we have to go on and get pissed off. I'm just looking for help and an explanation. And no actually, I can't come up with a good reason why this would not be discussed.. But nvm, I see this forum dosn't really feel the urge to help, nor be polite. So I will take my "shit" and go somewhere else..

Share this post


Link to post
Share on other sites

That part may be considered criminal impersonation, keyword "criminal", aka identity theft

Let me rephrase.

The only thing that will happen, is that your Name (That you can change at any given time) will be changed to the other persons name. This is not considered an criminal act, sorry for my bad description earlier.

Share this post


Link to post
Share on other sites

Bye..

Asshole..

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0