Jump to content

Copy text from window, then do something


 Share

Recommended Posts

Hi All,

I'm trying to write a script that takes the results from the window below, looks for only the numbers after the text "value:" (nothing beyond those numbers) and then copies that number and sends it to another windows input box. I've written the basic code to the point it waits until this window pops up... I'm just not sure how to write the remaining portion of the script.

Any and all help would be greatly appreciated!

 

image.png.51c5142c33f537ad5963c67fcc33dc91.png

Link to comment
Share on other sites

@JLogan3o13 See below, the $sText variable provides me with the data in the message box but I'm not sure what the formula would be for narrowing down the data to show only the information after the "value:" text and only 12 spaces after that. Then use that text to copy into another GUI's input window. 

 

#include <MsgBoxConstants.au3>


While 1

WinWait("WindowTitle", "TextToFindInWindow")
Local $sText = ControlGetText("WindowTitle", "", "WindowClassInstance")
MsgBox(0, "", $sText)

ExitLoop
WEnd

 

Link to comment
Share on other sites

@JLogan3o13 I've managed to narrow down the "Value:" data using an array by adding the following code, just not sure how to utilize that text after this point to send it to the input box-

 

$string = $sText
$array1 = StringSplit($string,"Value:,.",2)
_ArrayDisplay($array1, "", "23:23")

(Revision1)

I've also tried ArrawyToClip but I'm not fully understanding how to send that array data, testing with notepad. 

 

$string = $sText
$array1 = StringSplit($string,"Value:,.",2)
_ArrayToClip($array1, "", "23", "23")
MsgBox($MB_SYSTEMMODAL, "_ArrayToClip()", ClipGet())
Run("notepad.exe")
Sleep(2000)
Send("_ArrayToClip()", ClipGet()) ;DOES NOT WORK

(Revision2)

I was able to get send the text using the below, "hello" was just apart of the test. 

$Var = StringStripWS(ClipGet(), 😎
Send("Hello " & $Var)

Edited by The-dude
Link to comment
Share on other sites

The way to use ClipGet / ClipPut :

ClipPut("123")

$cVar0 = "ABC"

$cVar1 = ClipGet ()

MsgBox($MB_SYSTEMMODAL, "_ArrayToClip()", $cVar1)

ClipPut($cVar0)

$cVar1 = ClipGet ()

MsgBox($MB_SYSTEMMODAL, "_ArrayToClip()", $cVar1)

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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