Jump to content

Button Help Needed Please


Recommended Posts

What I am attempting seems so simple but I guess I can't put two and two together and come up with the code needed. What I need help with is a button in the GUI that will launch another program and do another action within that program.

GUICreate ("Program Master")

GuiSetControl("button","OK",50,70,70)
GuiSetControlNotify(2)

$val = RunWait("Notepad.exe", "C:\WINDOWS")
Send("Today's time/date is {F5}")

GUIWaitClose ()

The above works backwards. It launches Notepad and does nothing; when Notepad is closed it then launches the GUI with the button on it that also does nothing.

Any pointers for a lost soul ? :D

Link to comment
Share on other sites

GUICreate ("Program Master")

$button1= GuiSetControl("button","OK",50,70,70)
GuiSetControlNotify()

While GUIMsg() <> 0
 If GUIRead() = $button1 Then
    Run("Notepad.exe")
    WinWaitActive("Untitled", "")
    ControlSend("Untitled", "", "Edit1", "Today's time/date is {F5}")
 EndIf
Wend

Look the changes.... :D

Link to comment
Share on other sites

Something went wrong when I tried to run the script above.... I am using version 3.0.101.4 of the AutoIT-gui and get this error message.

Line 6

While GUIMsg() <>0

While ^ERROR

Error: Unknown function name.

Any other thoughts..... :D

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...