lawonama Posted November 5, 2011 Share Posted November 5, 2011 Func Test() ControlSend ("Naamloos","","", "TEST") Sleep(100) ControlSend ("Naamloos","","", "TEST") Sleep(100) ControlSend ("Naamloos","","", "{ENTER}") Sleep(7000) ControlSend ("Naamloos","","", "{F2}") EndFunc HotKeySet("{F2}", "Test") While 1 Sleep(100) WEnd Everything works fine, but it doesn't press F2 on the end. When I write TEST instead of {F2}, then that works too. But F2 won't work, any help? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2011 Moderators Share Posted November 5, 2011 lawonama,Because F2 is already set as your HotKey - all you are doing with the Send command is firing it again! Try it this way:HotKeySet("{F2}", "Test") While 1 Sleep(10) WEnd Func Test() ; Unset HotKey HotKeySet("{F2}") ControlSend("Naamloos", "", "", "TEST") Sleep(100) ControlSend("Naamloos", "", "", "TEST") Sleep(100) ControlSend("Naamloos", "", "", "{ENTER}") Sleep(7000) ; Send the key ControlSend("Naamloos", "", "", "{F2}") ; Reset the HotKey HotKeySet("{F2}", "Test") EndFunc ;==>TestOr use another key! 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...
lawonama Posted November 5, 2011 Author Share Posted November 5, 2011 Still not working . Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2011 Moderators Share Posted November 5, 2011 lawonama, So let us try a few more things: Are you sure that your "Naamloos" GUI is not refusing to accept F2? Are you sure that the GUI is active when you Send the key? Has it lost focus in the 7 seconds you are waiting? What happens if you get to the point where the F2 is needed and then use another HotKey to Send {F2}? Does it accept the key under those conditions? 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...
lawonama Posted November 5, 2011 Author Share Posted November 5, 2011 1- Im sure its not refusing F2, because I tried also F9, F8, F7 and SPACE and ENTER. 2- Its not losing its focus, because I also set it to 100 milliseconds, and still not working. 3- Still not working. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2011 Moderators Share Posted November 5, 2011 lawonama,because I tried also F9, F8, F7 and SPACE and ENTERAre you saying that the app refuses those keys as well? If so then you need to look at what has happened to your app after Sending the {ENTER} key. Soemthing must be making it refuse keys - the trick will be to find it. What is the app out of interest? 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...
lawonama Posted November 5, 2011 Author Share Posted November 5, 2011 The app is notepad, but its dutch. Link to comment Share on other sites More sharing options...
GEOSoft Posted November 5, 2011 Share Posted November 5, 2011 What is {F2} supposed to do in Notepad? I don't see anything in Notepad that refers to an {F2} shortcut at all. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2011 Moderators Share Posted November 5, 2011 George,I don't see anything in Notepad that refers to an {F2} shortcutThat is why I asked! lawonama,What do you expect F2 to do? 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...
lawonama Posted November 5, 2011 Author Share Posted November 5, 2011 F2 must sent the function TEST again. Link to comment Share on other sites More sharing options...
jchd Posted November 5, 2011 Share Posted November 5, 2011 From inside the function Test? Endless recursion! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2011 Moderators Share Posted November 5, 2011 (edited) lawonama,If you resend the function from within the function you will very quickly run into recursion problems. See the Recursion tutorial in the Wiki to learn more about this. If you want to run the function again and again you could do something like this:expandcollapse popupHotKeySet("{ESC}", "On_Exit") HotKeySet("{F2}", "Test") ; Create a flag to run the Send_Keys function Global $fRun_Func = False While 1 Sleep(10) WEnd Func Test() ; Reverse the flag $fRun_Func = Not $fRun_Func Switch $fRun_Func ; We run the function Case True ConsoleWrite("Started" & @CRLF) ; Run the Send_Keys function every 5 secs AdlibRegister("Send_Keys", 5000) ; Adjust the delay time to reflect the real time taken by the send function ; And we start sending the keys straight away Send_Keys() Case False ConsoleWrite("Stopped" & @CRLF) ; Stop the Send_Keys function from being called AdlibUnRegister("Send_Keys") EndSwitch EndFunc Func Send_Keys() ; Here is where you send your keys ConsoleWrite("We are sending the keys at " & @SEC & @CRLF) Sleep(5000) ; This is the length of time you need to put in the AdlibRegister command EndFunc Func On_Exit() Exit EndFuncNow you can start and stop your Send_Keys function whenever you want. All clear? M23Edit: You see, jchd agrees with me! Edited November 5, 2011 by Melba23 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