Jump to content

Help with Input & Read function


Enno
 Share

Recommended Posts

Hello all,

I am trying to make a script that sends the inputbox (the word/'s that are in the inputbox).

I have this:

#include <GUIConstantsEx.au3>

$mainwindow = GUICreate ("Ennø's Tracker",200,190)
GUISetBkColor (0x0077FF)
GUICtrlCreateLabel ("Ennø's Tracker",65,160)
GUICtrlCreateLabel ("v.01",90,175)
GUICtrlSetColor (-1, 0x000000)
$TrackButton = GUICtrlCreateButton ("Track",5,5,50)
$TrackName0 = GUICtrlCreateInput ("Track Name:",5,35,150)
$TrackName1 = GUICtrlCreateInput ("Track Name:",5,65,150)
$TrackName2 = GUICtrlCreateInput ("Track Name:",5,95,150)
$CloseButton = GUICtrlCreateButton ("Close",5,160,50)
$CreditsButton = GUICtrlCreateButton ("Credits",145,160,50)
$DaFoButton = GUICtrlCreateButton ("DaFo",80,125)
GUISetState (@SW_SHOW)

While 1
    $msg = GUIGetMsg (1)
    
Select
Case $msg = $TrackButton    
    SLeep (2000)
    GUICtrlRead ($TrackName0)
    Sleep (150)
    Send ("{ENTER}")
    Send ("/find $TrackName0")
    GuiCtrlRead ($TrackName1)
    Sleep (150)
    GUICtrlRead ($TrackName2)
    Sleep (150)
EndSelect
WEnd

Can anyone help me with this?

Link to comment
Share on other sites

I'm not sure what you are trying to do. I assume the SEND commands are going to a different application (Musick player)?

It would be best to "connect" to this application and send the data directly to the controls.

Could you please send more information about what you are trying to do and what problems you face?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I'm not sure what you are trying to do. I assume the SEND commands are going to a different application (Musick player)?

It would be best to "connect" to this application and send the data directly to the controls.

Could you please send more information about what you are trying to do and what problems you face?

Well, I am trying to make a person tracker for a game (it shows where the persons are, it is nice to have)

I want to send /zoek (which is the command for finding a person) and the name in the box (or should I just add /zoek in the box and then the name?)

Link to comment
Share on other sites

The problem with your current script is that it sends the information to the active window - which is the GUI of your script.

But you want to send the input of your GUI to another program (= your game).

So you need to get the window info and control info of the game where you want to send the info to. Please try the WindowInfo tool of AutoIt to search for the required information.

If you have any problems a screenshot of your game and the AutoIt WindowInfo tool could help.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The problem with your current script is that it sends the information to the active window - which is the GUI of your script.

But you want to send the input of your GUI to another program (= your game).

So you need to get the window info and control info of the game where you want to send the info to. Please try the WindowInfo tool of AutoIt to search for the required information.

If you have any problems a screenshot of your game and the AutoIt WindowInfo tool could help.

I have a delay of 2000miliseconds in it, so I have enough time to change to my game window, since it has no title according to the autoit window info.

I just want to know if I can send the text that is in the input window.

like:

Send ("$inputbox") or anything?

Link to comment
Share on other sites

Yes you can. Please try this:

Select
Case $msg = $TrackButton 
 SLeep (2000)
 $Track0 = GUICtrlRead ($TrackName0)
 Sleep (150)
 Send ("{ENTER}")
 Send ("/find " & $Track0)
 $Track1 = GuiCtrlRead ($TrackName1)
 Sleep (150)
 $Track2 = GUICtrlRead ($TrackName2)
 Sleep (150)
EndSelect
WEnd
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Yes you can. Please try this:

Select
Case $msg = $TrackButton 
 SLeep (2000)
 $Track0 = GUICtrlRead ($TrackName0)
 Sleep (150)
 Send ("{ENTER}")
 Send ("/find " & $Track0)
 $Track1 = GuiCtrlRead ($TrackName1)
 Sleep (150)
 $Track2 = GUICtrlRead ($TrackName2)
 Sleep (150)
EndSelect
WEnd

Tyvm :) Ill try it out in a minute.

Edit: It doesn't work ;), I also tried this:

Case $msg = $TrackButton 
 SLeep (2000)
 $Track0 = GUICtrlRead ($TrackName0)
 Sleep (150)
 Send ("{ENTER}")
 Send ("/find " & $Track0);changing this to: Send ($Track0)

hmm, I wonder why it doesnt work B)

Edited by Enno
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...