Sign in to follow this  
Followers 0
lawonama

Not sending a button

12 posts in this topic

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?

Share this post


Link to post
Share on other sites



lawonama,

Because F2 is already set as your HotKey - all you are doing with the Send command is firing it again! :D

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   ;==>Test

Or use another key! :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Still not working :D.

Share this post


Link to post
Share on other sites

lawonama,

So let us try a few more things: :D

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

lawonama,

because I tried also F9, F8, F7 and SPACE and ENTER

Are you saying that the app refuses those keys as well? :D

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. :oops:

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

The app is notepad, but its dutch.

Share this post


Link to post
Share on other sites

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!"

Share this post


Link to post
Share on other sites

George,

I don't see anything in Notepad that refers to an {F2} shortcut

That is why I asked! :oops:

lawonama,

What do you expect F2 to do? :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

F2 must sent the function TEST again.

Share this post


Link to post
Share on other sites

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 here
RegExp tutorial: enough to get started
PCRE 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)

Share this post


Link to post
Share on other sites

#12 ·  Posted (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. :oops:

If you want to run the function again and again you could do something like this:

HotKeySet("{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
EndFunc

Now you can start and stop your Send_Keys function whenever you want. :rip:

All clear? :D

M23

Edit: You see, jchd agrees with me!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0