Jump to content

ControlSetText?


 Share

Recommended Posts

was just wondering if I could somehow use ControlSetText to set the text into a GUICtrlCreateInput box, instead of having a gui window keep refreshing; such as this:

HotKeySet("{ESC}", "End")
HotKeySet("{F1}", "Toggle")

Global $State = 1
Global $ToggleState
Global $Toggle = True

If $Toggle = False Then
   $ToggleState = True
Else
   $ToggleState = False
EndIf

While $State = 1
   Sleep(100)
WEnd

Func Toggle()
   $ToggleState = NOT $ToggleState
    While $ToggleState
        $Mpos = MouseGetPos()
        $Mpos_x = $Mpos[0]
        $Mpos_y = $Mpos[1]
        Sleep(200)
        GUISetState(@SW_HIDE)

        GUICreate("Coords", 60, 30, 0, 0)
        GUICtrlCreateLabel("x=" & $Mpos_x & @CRLF & "y=" & $Mpos_y, 1, 0, 60, 30)
        GUISetState(@SW_SHOW)
    If Not $ToggleState Then
        Sleep(100)
    EndIf
   WEnd
      Sleep(100)
EndFunc

Func End()
   Exit
EndFunc

 

Edited by HankHell
Link to comment
Share on other sites

Hi

Something like this? :)

 

HotKeySet("{ESC}", "End")
HotKeySet("{F1}", "Get_Mouse_Pos")

$GUI = GUICreate("Coords", 60, 30, 0, 0)
$Label_x_y = GUICtrlCreateLabel("x=" & @CRLF & "y=", 1, 0, 15, 30)
$Label_x_value = GUICtrlCreateLabel("", 17, 0, 50, 13)
$Label_y_value = GUICtrlCreateLabel("", 17, 15, 50, 13)
GUISetState(@SW_HIDE)

While 1
Sleep(100)
 WEnd


Func Get_Mouse_Pos()

GUISetState(@SW_SHOW)

$Mpos = MouseGetPos()
$Mpos_x = $Mpos[0]
$Mpos_y = $Mpos[1]

GUICtrlSetData($Label_x_value, $Mpos_x)
GUICtrlSetData($Label_y_value, $Mpos_y)

EndFunc

Func End()
Exit
EndFunc

 

Link to comment
Share on other sites

14 hours ago, david1337 said:

Hi

Something like this? :)

 

HotKeySet("{ESC}", "End")
HotKeySet("{F1}", "Get_Mouse_Pos")

$GUI = GUICreate("Coords", 60, 30, 0, 0)
$Label_x_y = GUICtrlCreateLabel("x=" & @CRLF & "y=", 1, 0, 15, 30)
$Label_x_value = GUICtrlCreateLabel("", 17, 0, 50, 13)
$Label_y_value = GUICtrlCreateLabel("", 17, 15, 50, 13)
GUISetState(@SW_HIDE)

While 1
Sleep(100)
 WEnd


Func Get_Mouse_Pos()

GUISetState(@SW_SHOW)

$Mpos = MouseGetPos()
$Mpos_x = $Mpos[0]
$Mpos_y = $Mpos[1]

GUICtrlSetData($Label_x_value, $Mpos_x)
GUICtrlSetData($Label_y_value, $Mpos_y)

EndFunc

Func End()
Exit
EndFunc

 

I had something similar as my original coordinate finder, however it doesn't update in real-time to where my mouse is, I don't want to have to press a hotkey every time is all. I also want to use this to display other data without having the GUI constantly show and hide

Link to comment
Share on other sites

Okay, well then you just call the function inside your While loop? :)

 

HotKeySet("{ESC}", "End")
;~ HotKeySet("{F1}", "Get_Mouse_Pos")

$GUI = GUICreate("Coords", 60, 30, 0, 0)
$Label_x_y = GUICtrlCreateLabel("x=" & @CRLF & "y=", 1, 0, 15, 30)
$Label_x_value = GUICtrlCreateLabel("", 17, 0, 50, 13)
$Label_y_value = GUICtrlCreateLabel("", 17, 15, 50, 13)
GUISetState(@SW_HIDE)

While 1
Sleep(100)
Get_Mouse_Pos() ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 WEnd


Func Get_Mouse_Pos()

GUISetState(@SW_SHOW)

$Mpos = MouseGetPos()
$Mpos_x = $Mpos[0]
$Mpos_y = $Mpos[1]

GUICtrlSetData($Label_x_value, $Mpos_x)
GUICtrlSetData($Label_y_value, $Mpos_y)

EndFunc

Func End()
Exit
EndFunc

 

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