Immorto Posted August 4, 2013 Share Posted August 4, 2013 Hello! I've been fervorously attempting to fix an issue I've been having with my latest Autoit script..... I've been using AutoIt now for the past few years, and feel that I've got a (loose) grip on how it runs. I understand the mechanics behind what I'm trying to code, but no matter what I try, I can't get this simple script to function! I'm trying to generate a "Hotkeyset" function, so that when I press "=" it resumes my script, "-" to pause, and "x" to stop completely. Pretty damn simple. When I run my script normally, it works just fine, allowing me to hit "=" to start my script, "-" to pause etc. HOWEVER, since I'm trying to automate a standalone file w/ just a few keypresses (making my day to day life MUCH easier), whenever I open up the .exe and start my Hotkeyset, it won't run! Only until I click away from the file, THEN start it up, will it work. Unfortunately, since it needs to repeatedly pause and start, a dilemma ensues. Here's a simplified version of my current layout. Global $Paused HotKeySet("=","Leave") HotKeySet("-", "Pause") HotKeySet("x", "Stop") $go = True $Leave = False While $go if($Leave) Then Send("d") Sleep(1000) EndIf WEnd Func Pause() $Leave = False EndFunc Func Stop() ;to allow the script to stop Exit EndFunc Func Leave() $Leave = True EndFunc Like I said, it works when I click onto a different file, or folder, but ceases to work when I re-enter the file. Example: If I take this exact script, open a new notepad file, and hit "=" to start my code, my keyboard simulates the "d" keypress every 1 second. HOWEVER, if I swap over to my troublesome file, then my script stops communicating COMPLETELY. To test this, I swapped back and forth between notepad, and my file, and no "d" keys were entered on the notepad, even though more than one second had passed collectively. I "could" do without this script, but it would save me many a pain and agony down the line(isn't that what AutoIt is for?). Many thanks in advance! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 4, 2013 Moderators Share Posted August 4, 2013 Immorto,Welcome to the AutoIt forum. You speak of "automating a standalone file" - what app are you trying to automate? It may well be that it uses its own keyhandler and eats your keypresses - or it is resistant to automation in some way. If we knew the app we might even be able to suggest another way to do what you want - as I am sure sending multiple "d" keystrokes is not the limit of your ambition. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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