Scorpys 0 Posted December 9, 2021 Share Posted December 9, 2021 (edited) So I have this script (it's not the entire script, but it will do): WinActivate("[CLASS:phpdesktop-chrome]", "") Mouseclick("Left",591, 398, 2, 0) Sleep(250) MouseClick("right",591,398) Sleep(250) MouseClick("left",630,414) Sleep(250) $String = "60a8d8"; Change test to what your looking to find in the clipboard. $Result = StringInStr(ClipGet(), $String) If $Result > 0 Then Local $Magick = 'magick convert "C:\Users\ME\Desktop\Folder\photo.jpg" -fuzz 40% -fill "#ffffff" -opaque "#000000" "photo1.png"' RunWait(@ComSpec & " /c " & $Magick) Sleep(4000) MouseClick("left",1500,246) Sleep(250) MouseClick("left",738,462) Sleep(250) Send("text") Sleep(2000) The script selects some text, copies it to clipboard, then checks if the contents of the clipboard are "60a8d8," and if they are then it executes the rest of the script. My problem is with this line: $Result = StringInStr(ClipGet(), $String) The situation is that I have AutoIT working on another PC, and I have Anydesk open to watch that PC. But whenever something is copied to that PC's clipboard, it also gets copied to my lap top's clipboard, and it interferes with my work. I do a lot of copy/pasting in my work, and I can't have my clipboard just randomly populated with content from the PC I have open with Anydesk. So anyway, I need a way to not use "ClipGet." I did a few google searches and found nothing. Can AutoIT use something like this for example? $Result = StringInStr(SelectedTextGet(), $String) So instead of reading the clipboard, just read the selected text on the screen (without copying it to clipboard). Is it possible? Thanks Edited December 9, 2021 by Scorpys Link to post Share on other sites
Luke94 37 Posted December 9, 2021 Share Posted December 9, 2021 You could store the original clipboard text before copying and then put the original text back once you've done what you need to with the clipboard? Local $sOriginalText = ClipGet() ; Get the clipboard text before copying WinActivate("[CLASS:phpdesktop-chrome]", "") ; I assume the copying is done starting here? Mouseclick("Left",591, 398, 2, 0) Sleep(250) MouseClick("right",591,398) Sleep(250) MouseClick("left",630,414) Sleep(250) ; ending here $String = "60a8d8"; Change test to what your looking to find in the clipboard. $Result = StringInStr(ClipGet(), $String) ClipPut($sOriginalText) ; Put the original clipboard text back in the clipboard If $Result > 0 Then Local $Magick = 'magick convert "C:\Users\ME\Desktop\Folder\photo.jpg" -fuzz 40% -fill "#ffffff" -opaque "#000000" "photo1.png"' RunWait(@ComSpec & " /c " & $Magick) Sleep(4000) MouseClick("left",1500,246) Sleep(250) MouseClick("left",738,462) Sleep(250) Send("text") Sleep(2000) There would be a brief (< 1 second) period where the clipboard isn't the original text however. Link to post Share on other sites
Scorpys 0 Posted December 9, 2021 Author Share Posted December 9, 2021 Thanks for the reply Unfortunately that doesn't work for me. I need to take the clipboard completely out of the equation. It's not about the contents of the clipboard, it's about a change to the clipboard. Let's say there are 2 computers and their clipboards are synchronized. I'm using one PC, and the other is doing things automatically. Any change to the clipboard of either computer would update the clipboard on the other PC also, and I can't have that. Can't AutoIT do like a temporary read of currently active selected text without needing to store it somewhere? Link to post Share on other sites
Luke94 37 Posted December 9, 2021 Share Posted December 9, 2021 That would depend on what you're trying to read. Must it be selected and copied? ControlGetTextย may be of help, have a look at that. If you're reading text from Chrome then take a look atย @Danp2'sย WebDriver UDF. Link to post Share on other sites
Scorpys 0 Posted December 9, 2021 Author Share Posted December 9, 2021 It's not from a browser. The text is located on a program called "PHP Desktop". It's just a very old program which allows me to run a php script. So it's not a browser. Here: ย See, it's just text. Ancient text on an ancient program. I selected the 3rd on from the top. What my AutoIT script does is it goes through the texts there one by one, starting from the top. When and if it finds "60a8d8", it does certain actions. Link to post Share on other sites
Luke94 37 Posted December 9, 2021 Share Posted December 9, 2021 Have you tried using theย AutoIt Window Info Toolย on the controls? More importantly, the table. Link to post Share on other sites
Scorpys 0 Posted December 9, 2021 Author Share Posted December 9, 2021 Yes I tried it, but it doesn't recognize those texts individually. It just sees the program. The table? You mean the title? Anyway I tried it yes, but I can't get anything out of that. Then again, I'm no expert. Link to post Share on other sites
Luke94 37 Posted December 9, 2021 Share Posted December 9, 2021 Search the forum for UI Automation. You may be able to access the controls that way. Link to post Share on other sites
Scorpys 0 Posted December 9, 2021 Author Share Posted December 9, 2021 2 minutes ago, Luke94 said: Search the forum for UI Automation. You may be able to access the controls that way. Oh my God ๐ I thought it would be something simple, like turning this: $Result = StringInStr(ClipGet(), $String) Into this: $Result = StringInStr(SelectedTextGet(), $String) Or something like that... But if I have to read 7 books and graduate 3 universities to do it, forget about it ๐ Anyway I plan to replace this entire part of my script with something that works internally with commands, without having to click on coordinates on the screen and all that. So I guess I'll just turn off the "Clipboards synchronized" option in Anydesk until then. Should solve my problem for now. Now managing to find a way to read an image, extract the colors from it, list their hex codes, and then check them one by one until you find one of the two, in order to determine which actions to take, and do it all using commands, that's gonna be hard ๐ Link to post Share on other sites
Luke94 37 Posted December 9, 2021 Share Posted December 9, 2021 Quote Now managing to find a way to read an image, extract the colors from it, list their hex codes, and then check them one by one until you find one of the two, in order to determine which actions to take, and do it all using commands, that's gonna be hardย ๐ I don't think that's too hard, believe it or not. Take a look at the example forย _GDIPlus_BitmapGetPixel. Think it's a long process looping through each pixel but it'll work. Link to post Share on other sites
bobomb 20 Posted December 10, 2021 Share Posted December 10, 2021 (edited) Anydesk does have a text file I was thinking you would be able to edit in realtime located in %Appdata%\Roaming\Anydesk\system.conf but it appears process needs to be restarted for it to take effect if edited from outside the interface..ย Edited December 10, 2021 by bobomb Link to post Share on other sites
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