Jump to content

Creating a new window when pushing a button (dont need more help)


Recommended Posts

How can I make, so when I push the options button a new window will come?

I've read a bit and looked at a another script wich is nearly like mine, but I cant get it to work

Im might too stupid xD ...What should I write in the Case $button_2 thing?

Edit: I want the new window to be like the old one, but with other stuff on it, but I'll fix that myself, just so you know what I mean...

Oh well, heres my script:

#include <GUIConstants.au3>

GUICreate("I AM SIMIAN!")

GUISetBkColor (0xE0FFFF)

Opt("GUICoordMode",5)

$button_2 = GUICtrlCreateButton ("Options", 60, 30, 60)

$button_1 = GUICtrlCreateButton ("SIMIAN", 0, -1, 60)

GUISetState ()

While 1

$msg = GUIGetMsg()

Switch $msg

Case $GUI_EVENT_CLOSE

ExitLoop

Case $button_1

Run("C:\Program\Mozilla Firefox\firefox.exe")

Sleep(4500)

MouseMove(675,65)

MouseClick("left")

Sleep(1500)

Send("http://www.youtube.com/")

Send("{ENTER}")

Sleep(1500)

MouseMove(525,212)

MouseClick("left")

Sleep(2000)

Send("NOBODY KNOWS SIMIAN")

Send("{ENTER}")

Sleep(1000)

MouseMove(369,340)

MouseClick("left")

Sleep(1000)

MouseMove(593,860)

Exit

Case $button_2

EndSwitch

Wend

Edited by RandomGuest
Link to comment
Share on other sites

Firsty:

Run("C:\Program\Mozilla Firefox\firefox.exe")

Should be Run("C:\Program Files\Mozilla Firefox\firefox.exe")

Now:

#include <GUIConstants.au3>

GUICreate("I AM SIMIAN!")

GUISetBkColor(0xE0FFFF)

Opt("GUICoordMode", 5)

$button_2 = GUICtrlCreateButton("Options", 60, 30, -1, -1)

$button_1 = GUICtrlCreateButton("SIMIAN", 0, -1, 60)

GUISetState()
While 1
    $msg = GUIGetMsg()

    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $button_1
            Run("C:\Program Files\Mozilla Firefox\firefox.exe")
            Sleep(4500)
            MouseMove(675, 65)
            MouseClick("left")
            Sleep(1500)
            Send("http://www.youtube.com/")
            Send("{ENTER}")
            Sleep(1500)
            MouseMove(525, 212)
            MouseClick("left")
            Sleep(2000)
            Send("NOBODY KNOWS SIMIAN")
            Send("{ENTER}")
            Sleep(1000)
            MouseMove(369, 340)
            MouseClick("left")
            Sleep(1000)
            MouseMove(593, 860)
            Exit

        Case $button_2
            New()
    EndSwitch
WEnd

Func New()
    $newgui = GUICreate("NEW WINDOW")
    GUISetBkColor(0xE0FFFF)
    
    GUISetState()
    
    While WinExists($newgui)
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($newgui)
        EndSwitch
    WEnd
EndFunc   ;==>New
Link to comment
Share on other sites

Uuhm... try the script on your computer, and you'll see it does not work...

#include <GUIConstants.au3>

GUICreate("I AM SIMIAN!")

GUISetBkColor (0xE0FFFF)

Opt("GUICoordMode",5)

$button_2 = GUICtrlCreateButton ("Options", 60, 30, 60)

$button_1 = GUICtrlCreateButton ("SIMIAN", 0, -1, 60)

GUISetState ()
While 1
    $msg = GUIGetMsg()

    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $button_2
            make2()
            
            

    EndSwitch
Wend


Func Make2()
    
    GUICreate("sim2")
    $button3 = GUICtrlCreateButton("exit Sim 2",50,50,140,30)
    GUISetState()
    While 1
        $msg2 = GUIGetMsg()

        Switch $msg2
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $button3
                ExitLoop
        EndSwitch
    WEnd

    GUIDelete("sim2")
    
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...