6::
send 6
return
also tried
$6::send 6 return
$3::send 3 return
$5::send 3 return
Nor did blind or text or replacing send with any of the other sendmode names on the send doc page achieve the effect, which is, for a game to recognize these sends as numbers. These work while typing in chatbox ingame, i.e. "hello14674355", but not when selecting from a menu that use integers, i.e. "press a number from 1-9 to activate an option in a menu". I need ideas/help on what else i can try or do to get this to work. I have a situation where some numbered keys are hotkeys on certain condition (when im not typing for ex), this requires I manually setup the condition where they do send their own value. I need a fix for that. Is there way to retain their normal function as default, but check it only after the hotkey behaviour conditions? When they r in hitkey mode i need them to not send their own value but the hotkey.
Can I get ~3:: if(){... to work infront of 3's native function? then i can return early maybe so it doesnt proc the native 3 sending?
Related
I want define a custom hotkey to rename a selected file in File Explorer. So my new hotkey should behave exactly like the F2 key does by default. That is, when I press the hotkeys, the file name should be editable, allowing me to type a new name. However, I can't use the F2 key to cause windows to do this.
The reason is that I'm using the default hotkeys for something else. I am often running an application (unrelated to AutoHotKey) where the buttons in the UI are triggered using keyhooking for all of the F keys. The only suggestions that I can find on this are to have my custom hotkey use 'send' to raise the default key codes that would be associated with the action. This won't work, because I am using those hotkeys for something else. What I need is a solution that causes a file to be renameable without sending the F2 keycode.
^+!R::
Send {F2} ;This won't work for me
return
Actually the original hotkey can be used, just add $ before the hotkey that you don't want to be fired by the send command. Also using app-specific hotkeys a good idea to minimize possible conflicts.
Try this:
#If winActive("ahk_exe Explorer.EXE")
^+!R::
send {F2}
return
$F2::
send {down}
return
In case you have an application which scans the F2 key globally and unconditionally, and you cannot redefine it, there is not much you can do from within AHK. So ideally you should get rid of that application, and use e.g. AHK for same functionality, or find some workaround.
In this particular case the easiest workaround is alternative way to rename the file:
^+!R::
send {AppsKey}
sleep 100
send {m}
return
I'm using AutoHotkey. Is there a way of using "Send" without getting the previously wirtten Hotstring replaced?
So if I want to use the Hotkey System it always overrides the System with the text I set after "Send". But how can I achive that it is just appending my Send text to the hotstring?
Send, Hotstring Rest of Things You Want to Say
I think you may be mistaken in what you're trying to say or how you're using Send, as it doesn't replace previously written hotstrings. If you post an example of what you're saying, it will be easier to help. Also, what do you mean when you say "Hotkey System"?
Helpful info from the online documentation, Hotkeys & Hotstrings.
EDIT (per your comment below):
I understand what you're saying now. This is the default way that hotstrings work and has nothing to do with using the Send command. If you want to keep the activating text in a hotstring, you need to use the B0 option. Something like this:
:*B0:System::.out.println()
Note that the * makes it so you don't need to type a period after "system". If you want it to work that way instead, remove the asterisk.
Goal:
Use the hotkey 'C' to mimmic 'New Email Window' in Outlook, similar to Gmail.
Attempt:
c::
SetTitleMatchMode, 2
If Not WinActive("Message")
Send, ^n
return
Problem:
This script does work, but then inside that 'New Email' Window the 'c' char is locked out, and I can't use it while typing.
Tried Solutions:
I tried adding and empty an 'else {}' but that does not seem to work. Thoughts?
Environment:
Windows 10 / Outlook 2016+
This is probably what you want,
SetTitleMatchMode,2
#if WinActive("Microsoft Outlook")
{
c::
Send, ^n
return
}
This way, it will allow to type the char 'c' anywhere, including the new email window. But, it will trigger if you are in the main Outlook window, opening a new email window for you.
This uses context-sensitive title matching to map C to CTRL+Nwhen "Microsoft Outlook" is in the window title:
SetTitleMatchMode 2 ; All #If statements match anywhere in title
#IfWinActive Microsoft Outlook
c::^n
#IfWinActiv
This worked. I think in my case it needed to know specifically what to do if the window was not active, and in my case it was to fire a regular 'c', I would have thought that logic was built in by default recognize.
c::
SetTitleMatchMode 2
IfWinActive, Outlook
Send, ^n
Else
send, c
return
$c::
If (WinActive("Microsoft Outlook") { ;may/may not be "Microsoft Outlook' use window spy to find out more
send ^N ; if you got that to work then dont mess with this part
} else {
send {c}
}
Return
Basically this checks if Outlook is active then if so sends ^N and if not it will send the character C.
However this isnt the best idea: creating single key hotkeys that are used for typing...
Better idea: you change the hotkey ( the part before "::` ) to something like $^!c
( the $ is so that any other hotkey sending c wouldn't activate this one )
Another aproach would be:
$~c::
If (WinActive(ahk_class "outlook.exe") { ; or something along the lines of that...
sleep 250
send ^N
}
Return
For the most part this does the same thing except it retains the functionality of the c key better, however it may cause issues with typing in outlook so once again,
Please consider either a non-typing single key hotkey such as Rcontrol for example. The ~ in the hotkey means don't revoke original key functionality, The sleep is added to ensure that when you are using the hotkey that the retained c character isn't added to your new email.
Hope this helped ( I am fairly certain that this works ) I don't use outlook so I don't know how well Outlook will respond to this type of thing, and haven't tested this out but I do know my AHK basics and did do function syntax double checking so good luck to you, read my cmments in the code because they are essential to these code snippets functionality.
you may want to add && If (Not WinActive("Message")) ;or whatwver the message window is called if the two snippets didn't work for your needs add this because your new message window may also be called outlook so this will interfere with the typing.
My script is only activating when I press the numpad enter, is it possible for it to work if I press the big enter?
Here is what I have, when I type test + numpad enter then it invokes ctr+shift+u
:*:test`n::test^+u
I need the other enter to work or both if possible.
Thanks
I tried this:
:*:test`n::bob
And it types bob no matter which enter key I push. If you use n, that doesn't necessarily indicate that you are pushing anyenterkey - it just means you are inserting a carriage return - so eitherenter` key will do that. But your text area must be able to receive and insert a carriage return.
That means, that if you are working in a single-line text box, it can't receive a carriage return, in which case, using `n won't work for you.
You might also assure that the active window is able to receive ^!u and do something with that.
I am writing an AHK script to automate data entry into a GUI form. There is a drop-down box with a few hundred entries. I know the value I want to select and when I manually type in the number the combo box changes to the appropriate value. When I send the same string in AHK (using Send) it chooses the first item on the list. I have played around with various values of SetKeyDelay (-1 through 2000).
SetKeyDelay 1000
Send %ItemNumber%
SetKeyDelay -1
Any suggestions here?
Thanks
Jonathan
Have you tried other send modes? (Like SendInput, SendPlay, etc...)
Also, if it's a standard Windows combobox, it might be more precise to use messages (like CB_SETCURSEL).
Turns out there was a line up top that was messing me up:
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SendInput ignores the value of SetKeyDelay; the above line was converting all of my "Send"s to "SendInput"s
Thanks-
Jonathan