orestis125 Posted May 30, 2012 Share Posted May 30, 2012 (edited) Heya everyone,I'm new to this forum so please forgive me if I'm posting this on the wrong place. I've just encountered a problem with my script which prevents functions, that are called by pressing a hotkey, to be executed.I've tested a simple script which terminates itself when the letter "p" is pressed. Although this works perfectly when I'm working on the desktop, it doesn't work when I'm working on a full-screen/borderless program.This is my script:#Include <Misc.au3>;HotkeySet("p","terminate");While(true) ;Main LoopWEndFunc terminate()Exit;EndFuncIs there anyway to get around this problem? I'm not sure but I believe that it was working before on another computer. I've tried running the script in x64 and x86 but there doesn't seem to be any difference regarding this problem.Also I've got another small question. Is there a way to prevent the send() function from triggering hotkeys? For example, if I have a hotkey which is activated when "a" is pressed, and later in the program I'm calling send("a"), the hotkey would be activated.I would appreciate it if someone could give me a solution or a hint,Thank you very much,OrestisEdit: By the way my code appeared messy when I put it inside an AutoIt element so I just used a quote. I hope that's ok Edited May 30, 2012 by orestis125 Link to comment Share on other sites More sharing options...
JohnOne Posted May 30, 2012 Share Posted May 30, 2012 (edited) Your "full-screen/borderless program" is most likely eating the hotkey, or actively preventing automation. As for other problem. Func _Send($s) HotKeySet($s,"") Send($s) HotKeySet($s","_Func") EndFunc Edited May 30, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Exit Posted May 30, 2012 Share Posted May 30, 2012 ;#include <Misc.au3>; $rc = HotKeySet("p", "terminate"); If Not $rc Then Exit MsgBox(262144,"",@lf & "Hotkeyset Error " & $rc & @lf,0) While 1 Sleep(2000) ; wait 2 secobnds Beep(440,200) ; and beep to show "beeing alive" ;Main Loop WEnd Func terminate() HotKeySet("p") ; cancel hotkey MsgBox(262144, "", @LF & " Hotkey disabled " & @LF, 2) Exit; EndFunc ;==>terminate App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 30, 2012 Moderators Share Posted May 30, 2012 orestis125,I'm working on a full-screen/borderless programWould you care to let us know what the particular full screen/borderless program is? The more information you give, the more focused the help you are likely to get. 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...
woody0 Posted January 11, 2013 Share Posted January 11, 2013 I might be having the same problem here, and I'm not sure how to get around it. I'm trying to use this to do some automated user interface testing to click around on the Microsoft windows mobile device emulator. I'm really just trying to implement a simple exit key to stop the script from executing. The script below works, and the start, stop and exit functions all work up until the TestCustomer() function is entered. once that starts, there's no stopping it until the loop reaches the counter value. One that function starts, none of the hot keys fire anymore. I'm thinking that once the device emulator window has focus that all keyboard input gets sent to the emulator and bypasses the script. Any ideas how to get around this? expandcollapse popupHotKeySet("{F2}", "_start") HotKeySet("{F8}", "_stop") HotKeySet("{ESC}", "_exit") $stop = False $started = False $exit = False $sleepDefault = 500 $sleepOffset = 2000 $i = 0 While 1 if $i > 1 or $exit then ExitLoop ; Need this to get out eventually if $started Then TestCustomer() $i = $i + 1 EndIf sleep (100) WEnd Func TestCustomer() MouseClick("left",117,152,1) ; Customer sleep($sleepDefault + $sleepOffset) MouseClick("left",183,270,2) ; Double Click customer sleep ($sleepDefault) MouseClick("left",94,414,1) ; Back sleep ($sleepDefault) MouseClick("left",94,414,1) ; Home sleep ($sleepDefault) EndFunc Func _start() Consolewrite("Started") $stop = False $started = True EndFunc Func _stop() ConsoleWrite("stop") $stop = True $started = False EndFunc Func _exit() ConsoleWrite("Exit") $exit = True Exit EndFunc Link to comment Share on other sites More sharing options...
BrewManNH Posted January 11, 2013 Share Posted January 11, 2013 Does it work with other windows active? If it does, then it's the program that you're trying to click into. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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