Jump to content

Recommended Posts

Posted

Hi all,

I'm a newbie with AutoIT. I've written a script with the purpose being to copy some all text from a mini window (from MightyText app on my PC) by simply send Ctrl + A and Ctrl + C to that window to get all text, but this is not stable. Sometimes it works, and sometimes it doesn't. This is my code :

Local $oldClip = ClipGet(); get the data that is currently in the clipboard

 Local $hWn1 = WinWait("MightyText - ", "",30) ; wait for MightyText window appear
  If WinExists($hWn1) Then

   Sleep(300)
   WinActivate($hWn1);Active window
   Sleep(1500)
    ControlFocus($hWn1,"","[CLASS:Intermediate D3D Window; INSTANCE:1]"); forcing focus to MightyText window
    Sleep(500)
    ControlSend($hWn1,"","","{CTRLDOWN}{a}{CTRLUP}")
    Sleep(200)
    ControlSend($hWn1,"","","{CTRLDOWN}{c}{CTRLUP}")
    Sleep(200)

   WinClose($hWn1)
   Sleep(300)

   $phrase = ClipGet(); get the data from the clipboard (which is now the selected word)

Please help to fix this code to increase the rate at which this succeeds. :((

 

Posted

Dear @FrancescoDiMuro,

I want to get all text from a window that create by a program is called by MightyText (It simply a program on PC that could send my SMS from my mobile to my PC). So, basicly, I tried to sent to that windows "Ctrl + A" and then "Ctrl + C" to get all text. But this code have some problem, it's not stable, sometime it work normally and sometime it doesn't work (It didn't send Ctrl + A and Ctrl +C to the window). So i need to help to optimize this code to increase the rate succeed.

Posted
2 minutes ago, FrancescoDiMuro said:

@Achilles86
Did you check for errors when you call the function? :)

The function run with no error, but it can not get from all text that i want... I just want to select all and copy all entries of that window....

Posted
23 minutes ago, mikell said:

Did you try

ControlSend($hWn1,"","","^a") 
ControlSend($hWn1,"","","^c")

?

Edit:  or

WinGetText("[active]")

 

Dear Mikell, i tried both of your methods : First is the same my code (sometime normal, sometime doesnt work and i dont know why) , About WinGetText function : it's the same ControlGetText - not all of entries text from the window

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...