Achilles86 Posted July 30, 2018 Posted July 30, 2018 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. :((
FrancescoDiMuro Posted July 30, 2018 Posted July 30, 2018 Hi @Achilles86, and welcome to the AutoIt forum What is the issue? Describes it as much as you can Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Achilles86 Posted July 30, 2018 Author Posted July 30, 2018 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.
FrancescoDiMuro Posted July 30, 2018 Posted July 30, 2018 @Achilles86 What about ControlGetText() function? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Achilles86 Posted July 30, 2018 Author Posted July 30, 2018 Dear @FrancescoDiMuro I tried it (Function ControlGetText() ), but it got nothing...
FrancescoDiMuro Posted July 30, 2018 Posted July 30, 2018 @Achilles86 Did you check for errors when you call the function? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Achilles86 Posted July 30, 2018 Author Posted July 30, 2018 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....
mikell Posted July 30, 2018 Posted July 30, 2018 (edited) Did you try ControlSend($hWn1,"","","^a") ControlSend($hWn1,"","","^c") ? Edit: or WinGetText("[active]") Edited July 30, 2018 by mikell
Achilles86 Posted July 30, 2018 Author Posted July 30, 2018 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now