Jump to content

Gotta start somewhere.


Recommended Posts

First yes I have the betta yes I use SciTE for editing.

Ok so I created a form with a bunch of buttons.

Sample: GuiCtrlCreateButton("regedit", 373, 330, 90, 20) and as a standalone

script i can make it run.

Run("regedit.exe") Now my questions.

A / When I click the button "regedit' what kind of code is required to run,start regedit.exe?The script without form works fine.

B / I am looking to make a popup appear for confirmation.IE:Run bla bla bla?ok/cancel

C / I can make a script to run a .VBS file but again can't figure out the on click or do or function.

D / When I place a picture acoss the form the buttons are still vissible but don't click.Send picture to back? how?

I guess a button that runs something other than a msg would be a nice place to start with autoit3 no?

All or any help to let the fun begin would be most appreciated.

Humble beginnings.

P.s most of the sample scipts provided show error.

Error parsing,Error unknown function,unresolved etc... Hard to learn that way.

Link to comment
Share on other sites

There are two approaches. I usually use the first method; however, the second way is better structured for complex GUIs and is similar to other programming languages.

The code for a confirmation box would be the same, but I just put it in the second example.

When a picture overlaps with a button, you need to disable the picture:

#include <GuiConstants.au3>
$myPic = GuiCtrlCreatePic("something.jpg", 10, 10)
GUICtrlSetState(-1, $GUI_DISABLE)
Just so you know, -1 in the above line referes to the most recently created control.  I could have also said GUICtrlSetState($myPic, $GUI_DISABLE)

Answers to question A:

#include <GuiConstants.au3>
GuiCreate("Example One")

$Button1 = GuiCtrlCreateButton("Launch Regedit", 100, 100, 200, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button1
            Run("regedit.exe")
    EndSelect
WEnd

#include <Constants.au3>
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

GUICreate("Example Two")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

$Button1 = GUICtrlCreateButton ("Launch Regedit",  10, 10, 100, 30)
GUICtrlSetOnEvent(-1, "RegeditButtonclicked")


GUISetState()

; Just idle around
While 1
    Sleep(10)
Wend


Func RegeditButtonclicked()
    $answer = MsgBox($MB_YESNO, "Confirm", "Do you want to run regedit?")
    If $answer = $IDYES Then Run("regedit.exe")
EndFunc

Func SpecialEvents()
    If @GUI_CTRLID = $GUI_EVENT_CLOSE Then Exit
EndFunc
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Has no-one noticed that this is in the wrong forum. This is the V2 Support forum.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...