Jump to content

Whats wrong with this code?


Recommended Posts

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("MyGUI", 355, 63,(@DesktopWidth-355)/2, (@DesktopHeight-63)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Input_1 = GuiCtrlCreateInput("Type Here!", 60, 10, 180, 20)
$Button_2 = GuiCtrlCreateButton("Go", 250, 10, 100, 20)
$Label_3 = GuiCtrlCreateLabel("Enter the name of a Window (E.G AOL 9.0) and click go", 60, 40, 290, 20)
$Icon_4 = GuiCtrlCreateIcon("Ico1", 0, 10, 10, 32, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    Case $guimsg = $Button_2
    while 1
    $Proc WinGetProcess($Input_1)
    tooltip($Proc)
    sleep(100)
    wend
    EndSelect
WEnd
Exit

When i click 'Go' nothing happens, whats wrong?

Avatar made on Gmod for HL2 by me!Name on Gmod: Oclops

Link to comment
Share on other sites

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("MyGUI", 355, 63,(@DesktopWidth-355)/2, (@DesktopHeight-63)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Input_1 = GuiCtrlCreateInput("Type Here!", 60, 10, 180, 20)
$Button_2 = GuiCtrlCreateButton("Go", 250, 10, 100, 20)
$Label_3 = GuiCtrlCreateLabel("Enter the name of a Window (E.G AOL 9.0) and click go", 60, 40, 290, 20)
$Icon_4 = GuiCtrlCreateIcon("Ico1", 0, 10, 10, 32, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;
    Case $guimsg = $Button_2
    while 1
    $Proc WinGetProcess($Input_1)
    tooltip($Proc)
    sleep(100)
    wend
    EndSelect
WEnd
Exit

When i click 'Go' nothing happens, whats wrong?

your case else is being called, and doing nothing, so the select structure exits before the button case. remove the case else if it does nothing, or move it below the case for the button.
Link to comment
Share on other sites

  • Moderators

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("MyGUI", 355, 63,(@DesktopWidth-355)/2, (@DesktopHeight-63)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Input_1 = GuiCtrlCreateInput("Type Here!", 60, 10, 180, 20)
$Button_2 = GuiCtrlCreateButton("Go", 250, 10, 100, 20)
$Label_3 = GuiCtrlCreateLabel("Enter the name of a Window (E.G AOL 9.0) and click go", 60, 40, 290, 20)
$Icon_4 = GuiCtrlCreateIcon("Ico1", 0, 10, 10, 32, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;
    Case $guimsg = $Button_2
    while 1
    $Proc WinGetProcess($Input_1)
    tooltip($Proc)
    sleep(100)
    wend
    EndSelect
WEnd
Exit

When i click 'Go' nothing happens, whats wrong?

Case $guimsg = $Button_2

Case $msg = $Button_2

Edit:

Remove the Case Else as camerons dad suggested and:

$Proc WinGetProcess($Input_1)

Is probably going to thro an error too... no '=' sign. Edited by SmOke_N

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.

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