jk_ Posted April 5, 2020 Share Posted April 5, 2020 Hi there, I'd like to use Autoit for a simple thing: When using Photoshop (and only on Photoshop, if that is able), whenever I press my left-control and the d at the same time, I would want that to be remapped to left-control and right-click. I am sure this is easy, however I havent learned any knowledge in this field. Thank you if you would just show me how I can have it done. Link to comment Share on other sites More sharing options...
alienclone Posted April 5, 2020 Share Posted April 5, 2020 check out the functions... HotKeySet() this function can intercept the pressing of LCTRL+d and run commands. WinActive() inside the hotkeyset use if statements to check if Photoshop window is active. Send() if Photoshop window is active, Send LCTRL and... MouseClick() the sending of LCTRL+ right mouse click may be a little tricky, i have to tested so im not sure if this is the best method. If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
seadoggie01 Posted April 6, 2020 Share Posted April 6, 2020 (edited) You'll probably want to send a left control down command, click with the mouse, and send a left control up command... like this ; Hold the left control down Send("{LCTRL down}") ; Click with the Mouse MouseClick("right") ; Release the left control Send("{LCTRL up}") It'll be better if there is a particular control that you can send these commands to with ControlSend instead of Send as it's much more reliable. Edited April 6, 2020 by seadoggie01 Right click, left control, dyslexia at it again All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
markyrocks Posted April 6, 2020 Share Posted April 6, 2020 (edited) ;just an example may not be 100% accurate Hotkeyset("{LCTRL}+d","remap") local $bool=false ;to toggle while 1 Sleep(25) Wend func remap() if $bool=false then send("{LCTRLDOWN}") mouseclick("right") send("{LCTRLUP}") $bool=true return elseif $bool=true then $bool=false return endif endfunc Just to clarify you this sounds like youd need to use the hotkey function so that it triggers a different function to send the desired key press and click. ;just an example may not be 100% accurate Hotkeyset("{LCTRL}+d","remap") while 1 Sleep(25) Wend func remap() send("{LCTRLDOWN}") mouseclick("right") send("{LCTRLUP}") endfunc Edit!! Cleaned up... Edited April 6, 2020 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
Nine Posted April 6, 2020 Share Posted April 6, 2020 @markyrocks Why do you do that ? Why do you provide code that is totally wrong ? I don't get your eager to help, but posting code that is so badly written. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
markyrocks Posted April 6, 2020 Share Posted April 6, 2020 (edited) 31 minutes ago, Nine said: @markyrocks Why do you do that ? Why do you provide code that is totally wrong ? I don't get your eager to help, but posting code that is so badly written. What is wrong with what I wrote? The hotkey function requires another function to operate.... If theres no while loop the script will just immediately exit. This is stuff complete noobs don't know.... Edited April 6, 2020 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
Developers Jos Posted April 7, 2020 Developers Share Posted April 7, 2020 9 hours ago, markyrocks said: Edit!! Cleaned up... Nearly there....You should also use Tidy to make it more readable. This is a shorter cleaned up version of your code: ;just an example may not be 100% accurate HotKeySet("{LCTRL}+d", "remap") Global $bool = False ;to toggle While 1 Sleep(25) WEnd Func remap() If $bool = False Then Send("{LCTRLDOWN}") MouseClick("right") Send("{LCTRLUP}") EndIf $bool = Not $bool EndFunc ;==>remap Jos markyrocks and seadoggie01 2 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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