shmuelw1 Posted January 12, 2011 Share Posted January 12, 2011 I wrote a script to copy the filename of a file that I click on, and paste it over the filename of another file that I click on (but not over the file extension). For some reason the script is never getting to Func Clicked() no many how many times I click.Any ides?expandcollapse popup; Copies filename and extension from selected file to another selected file, but ; does not paste over the file extension of the 2nd file ; #include "Other\MyFunctions.au3" #include <GUIConstantsEx.au3> ; defines various GUI events Dim $numClicks = 0 Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Clicked") While 1 Sleep(1000) WEnd Func Clicked() $numClicks = $numClicks + 1 Select Case $numClicks = 1 ; on 1st nouse click, copy the filename Send("{APPSKEY}") Sleep(200) Send("{UP 2}") Send("{ENTER}") Sleep(200) Send("^c") Send("{ENTER}") Case $numClicks > 1 ; on 2nd nouse click, paste the filename Send("{APPSKEY}") Sleep(200) Send("{UP 2}") Send("{ENTER}") Sleep(200) Send("{LEFT 4}") Sleep(200) Send("^+{HOME}") Send("^v") Send("{ENTER}") Exit EndSelect EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2011 Moderators Share Posted January 12, 2011 shmuelw1,That is because you do not have a GUI to click in! You will have to use _IsPressed to register the clicks. 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...
shmuelw1 Posted January 13, 2011 Author Share Posted January 13, 2011 Thanks! I didn't know GUISetOnEvent and GUICtrlSetOnEvent were only for an AutoIt GUI. That should be added it the AutiIt help, along with a reference to _IsPressed.shmuelw1,That is because you do not have a GUI to click in! You will have to use _IsPressed to register the clicks. M23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 13, 2011 Moderators Share Posted January 13, 2011 shmuelw1,The clue in the name (GUISetOnEvent and GUICtrlSetOnEvent) is not enough? 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...
shmuelw1 Posted January 13, 2011 Author Share Posted January 13, 2011 I don't use AutoIt for GUIs, so for me it was not enough. I just want a simple script for keystrokes in Windows programs, but I want it to pause until the next mouse click. I did some searching in the help and all I found was GUISetOnEvent and GUICtrlSetOnEvent.So I think it would be helpful to have a reference in these functions to _IsPressed. I did see IsPressed mentioned on the web, but I couldn't find it because they left out the underscore before it. At least this new topic should be find-able since I gave it a decent title Thanks everyone for the help!shmuelw1,The clue in the name (GUISetOnEvent and GUICtrlSetOnEvent) is not enough? M23 Link to comment Share on other sites More sharing options...
shmuelw1 Posted January 13, 2011 Author Share Posted January 13, 2011 OK, here it is, and it works. Thanks Melba23! ; Copies filename and extension from selected file to another selected file, but ; does not paste over the file extension of the 2nd file #Include <Misc.au3> ; for _IsPressed $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Or _IsPressed("02", $dll) Then ExitLoop WEnd Send("{APPSKEY}") Sleep(200) Send("{UP 2}") Send("{ENTER}") Sleep(200) Send("^c") Send("{ENTER}") While 1 If _IsPressed("01", $dll) Or _IsPressed("02", $dll) Then ExitLoop WEnd Send("{APPSKEY}") Sleep(200) Send("{UP 2}") Send("{ENTER}") Sleep(200) Send("{LEFT 4}") Sleep(200) Send("^+{HOME}") Send("^v") Send("{ENTER}") Exit DllClose($dll) 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