MarkNich Posted March 23, 2021 Share Posted March 23, 2021 We use OtsAV to run our community radio station and we have used AutoIt scripts to automate some things in OtsAV for many years. We just updated our OS to Windows 10 after our system crashed and now AutoIt scripts that have worked for years no longer work. Specifically they don't Send the characters to OtsAV that we're trying to send. Here's a sample of a script that used to work but now doesn't: #include <MsgBoxConstants.au3> WinWait("OtsAV", "") If Not WinActive("OtsAV", "") Then WinActivate("OtsAV", "") WinWaitActive("OtsAV", "") ; send the shortcut keys to get to the Import/Refresh Album Files dialog box Send("!f") Sleep(500) Send("f") Sleep(500) Send("i") Sleep(500) Send("{ENTER}") ; get the Import/Refresh Album Files dialog box active WinWait("Import/Refresh Album Files", "") MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) I threw in the MsgBox call to try and figure out what was going on. If I run this script it activates the OtsAV window but doesn't seem to send the characters and the script hangs at the WinWait call. I can tell this because if after running the script I manually type in the characters that were supposed to be sent, the message box pops up. I'm not an AutoIt expert and I only hacked these scripts together years ago because it was the only way to update certain things in OtsAV. Any help/suggestions would be appreciated. You can stream our station at kpup.rocks if you want a good mix of eclectic music! Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 24, 2021 Share Posted March 24, 2021 @MarkNich Send() is not a reliable function like ControlSend(), for example. You have to make sure that all the previous functions are working correctly, so, put some error checking and debug your script. Use the code tags <> in the bar above when you post the code, and let us know how it goes with your debugging Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
TheXman Posted March 24, 2021 Share Posted March 24, 2021 (edited) 13 hours ago, MarkNich said: Specifically they don't Send the characters to OtsAV that we're trying to send. One of the most common causes of the Send() function not sending keys after switching to Windows 10 is because of Windows 10's enhanced security features. A non-elevated process cannot send keys to an elevated process. To see if that's the issue you're having, you can try one of the following: Add the #RequireAdmin directive to the top of your script. or If the script is compiled, right-click it and select the "Run As Admin" option On a side note when using WinWait or WinWaitActive, if you set a timeout, then you can gracefully exit/return if the windows does not appear or become active instead of your script waiting forever. For example: ;Wait up to 3 seconds for the window to appear If Not WinWait("Some title", "", 3) Then MsgBox($MB_ICONWARNING + $MB_TOPMOST, "WARNING", "Timed out waiting for some title.") Exit 1 EndIf Edited March 24, 2021 by TheXman Skysnake, FrancescoDiMuro and Earthshine 3 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
MarkNich Posted March 24, 2021 Author Share Posted March 24, 2021 Thanks, both of you. TheXman's suggestion worked, to use the #RequireAdmin directive. Link to comment Share on other sites More sharing options...
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