Doing my taxes and the *&%*(^* H&R Block software will not allow me to paste numbers into the software fields... major problem.
Can someone point me to info or a script to create a new macro in my primary AHK script that will take what is in the clipboard and assign it to a key that can then be typed to the keyboard without having to load a new script?
Thanks in advance,
Beverly Howard
Paste Alternative Script?
Re: Paste Alternative Script?
Code: Select all
F3::Send %Clipboard%
Re: Paste Alternative Script?
Damm... sometimes forums can make me feel pretty dumb
Thanks!
Beverly Howard
Thanks!
Beverly Howard
Re: Paste Alternative Script?
It's the H&R that's killing you! I found bugs this year. Moving to Turbo next time.
Re: Paste Alternative Script?
Now I know why I needed to ask this question.
Been using AHK for many years, but have only used it as a "menu" i.e. one hotkey starts the menu then I have cascading menus to execute over 50 macros with only one or two additional keystrokes.
So to add a dedicated hotkey in addition to the menu, is all I need to do is put key key definition after the menu code? (putting it before the menu entries doesn't work)
-====================-
Doing this, I found that I had already created a "slow paste" macro to deal with some webpages that defeat pasting and normal macros in a crude attempt to restrict data entry to normal typing speeds in an attempt to verify that a human is filling in the entry. When I tried that, it didn't work on H&R.
So, I used your suggested solution of programming a dedicated function key... and that worked... thanks!
Beverly Howard
Some programs simply can't maintain focus
Beverly Howard.
Been using AHK for many years, but have only used it as a "menu" i.e. one hotkey starts the menu then I have cascading menus to execute over 50 macros with only one or two additional keystrokes.
So to add a dedicated hotkey in addition to the menu, is all I need to do is put key key definition after the menu code? (putting it before the menu entries doesn't work)
-====================-
Doing this, I found that I had already created a "slow paste" macro to deal with some webpages that defeat pasting and normal macros in a crude attempt to restrict data entry to normal typing speeds in an attempt to verify that a human is filling in the entry. When I tried that, it didn't work on H&R.
So, I used your suggested solution of programming a dedicated function key... and that worked... thanks!
Beverly Howard
Some programs simply can't maintain focus
Beverly Howard.
Last edited by bevhoward on 29 Sep 2020, 07:33, edited 1 time in total.
Re: Paste Alternative Script?
You are welcome. You are correct: code to be executed upon run goes at the top, while hotkeys and hotstrings go after that. The top part is sometimes called the auto-execute section. The script executes from the top, until it encounters Return, Exit, a hotkey, a hotstring, or the end of the script-- whichever comes first. It then "stops" and waits, or follows the Return or Exit. Therefore, if you have menu-type code after a hotkey, it will never execute unless called as part of a subroutine, function, etc. If you can imagine that the name of a hotstring or hotkey is actually a label, and that the script's first such label of a hotstring or hotkey functions as Return-- both of which are true-- then you will see why the hotstrings and hotkeys must come after the code to be executed.
Re: Paste Alternative Script?
It might be necessary sometimes to use either the raw or text mode:
Here's a particular case of auto-execute section with a gosub, paradoxically confirming the rule (as for static initializers, they are initialized only once and before even the script begins executing):
A_AhkUser
Code: Select all
F3::SendInput % "{Text}" . Clipboard
Code: Select all
Gosub, sub
!i::MsgBox % A_ThisHotkey ; end of the auto-execute section
!j::MsgBox % A_ThisHotkey
!k::MsgBox % A_ThisHotkey
!l::MsgBox % A_ThisHotkey
sub:
MsgBox, testing from the auto-execute section (at the bottom of the script)
return
function() {
static _ := function()
MsgBox % A_ThisFunc
}
Re: Paste Alternative Script?
Good point. Adding {Text} is often recommended when the string is known to have only text, rather than any "special" characters such as modifiers.
Interesting script! A function that calls itself. I was surprised at the findings, but your explanation, well, explains them.
Interesting script! A function that calls itself. I was surprised at the findings, but your explanation, well, explains them.
Re: Paste Alternative Script?
Thanks again to both.
AHK has proven to be a key weapon in the battle against clueless form programmers
Beverly Howard
AHK has proven to be a key weapon in the battle against clueless form programmers
Beverly Howard
Re: Paste Alternative Script?
You have me on the road to expanding my AHK knowledge, but I am stuck on something simple.
has quickly become valuable. I didn't realize how often that commands within AHK menus were being problematic because of loss of focus.
I now have the above macro following my menus, but, I would like to add my "Slow Paste" macro and do so by assigning it to Shift-F3 and while I know how to use modifiers in AHK output, I can't find a reference to use it with a key assignment.
Code: Select all
F3::Send %Clipboard%
I now have the above macro following my menus, but, I would like to add my "Slow Paste" macro and do so by assigning it to Shift-F3 and while I know how to use modifiers in AHK output, I can't find a reference to use it with a key assignment.
Code: Select all
USLOWP:
setkeydelay 50,50
send %clipboard%
return
Re: Paste Alternative Script?
You mean +F3:: ?
Re: Paste Alternative Script?
Yep... I think... Thanks... will proceed. That also answers the other modifier keys.You mean +F3:: ?
Beverly Howard
Re: Paste Alternative Script?
Which then brings up multiple commands in a key assignment.
I need to add as part of the command, so how do I add that before
A related question;
I also have the "slow paste" command I need in a menu call named USLOWP:
I'm guessing that a key assignment can also execute the same routine, but don't know the syntax within a key reassignment nor if I may get something recursive.
Thanks in advance,
Beverly Howard
I need to add
Code: Select all
setkeydelay 50,50
Code: Select all
Send %Clipboard%
I also have the "slow paste" command I need in a menu call named USLOWP:
I'm guessing that a key assignment can also execute the same routine, but don't know the syntax within a key reassignment nor if I may get something recursive.
Thanks in advance,
Beverly Howard
Re: Paste Alternative Script?
Like you did above. But note that SetKeyDelay only works if you don't use Sendinput mode - so of you have SendMode Input somewhere at the start of the script, you will have to remove that.bevhoward wrote: ↑29 Sep 2020, 18:07I need to addas part of the command, so how do I add thatCode: Select all
setkeydelay 50,50
You can stack labels (that includes hotkeys) that should share the same code, like for example:I also have the "slow paste" command I need in a menu call named USLOWP:
I'm guessing that a key assignment can also execute the same routine, but don't know the syntax within a key reassignment nor if I may get something recursive.
Code: Select all
+F3::
USLOWP:
; some code
return
Re: Paste Alternative Script?
I tried that, but AHK complained that the label was duplicated in the script.You can stack labels (that includes hotkeys) that should share the same code, like for example:
So, I moved the USLOWP: code to the +F3:: key assignment using the sample you posted
Testing shows that the FKey reassignment works AND that when the menu command is issued, it finds the label in the F3 key reassignment and executes it as well.
Is that acceptable... In other words, is doing that going to bite me somewhere down the line?
Thanks for the education,
Beverly Howard
Re: Paste Alternative Script?
Should be ok - that's how it's intended.
But sure, you can have labels only once (execeptions would be context-sensitive hotkeys, but we don't have them here).
As I understood it, you want to execute exactly the same code via +F3 and the menu label. Then this would be the way to go (afaics, without knowing the details).
But sure, you can have labels only once (execeptions would be context-sensitive hotkeys, but we don't have them here).
As I understood it, you want to execute exactly the same code via +F3 and the menu label. Then this would be the way to go (afaics, without knowing the details).
Re: Paste Alternative Script?
The only problem that this creates for me is that over the years I have tried to keep my .AHK script well structured and grouped. (old age, memory loss, etc. ya know)
...for example, the "U" in "USLOWP" is short for "Utility" and all of the macros in that menu are labeled starting with "U" and grouped together so that they are easy to find, edit and add to.
Of course, this need might be my permission to return to code chaos
One more related question...
When I was implementing and testing earlier, I noticed that when I had line breaks in the text contained on the clipboard, pasting the content using they keyboard (<Ctrl-V>) was as expected, but, when any of the AHK paste macros typed the clipboard content, the line breaks were doubled.
The need will probably never come up based on my needs for an alternate paste option, but can this be addressed?
Thanks again,
Beverly Howard
...for example, the "U" in "USLOWP" is short for "Utility" and all of the macros in that menu are labeled starting with "U" and grouped together so that they are easy to find, edit and add to.
Of course, this need might be my permission to return to code chaos
One more related question...
When I was implementing and testing earlier, I noticed that when I had line breaks in the text contained on the clipboard, pasting the content using they keyboard (<Ctrl-V>) was as expected, but, when any of the AHK paste macros typed the clipboard content, the line breaks were doubled.
The need will probably never come up based on my needs for an alternate paste option, but can this be addressed?
Thanks again,
Beverly Howard
Re: Paste Alternative Script?
If you want to keep your hotkeys seprate, you can do it. Just use gosub:bevhoward wrote: ↑29 Sep 2020, 20:52The only problem that this creates for me is that over the years I have tried to keep my .AHK script well structured and grouped. (old age, memory loss, etc. ya know)
...for example, the "U" in "USLOWP" is short for "Utility" and all of the macros in that menu are labeled starting with "U" and grouped together so that they are easy to find, edit and add to.
Of course, this need might be my permission to return to code chaos
Code: Select all
; Hotkeys --------------
+F3::gosub USLOWP
; more hotkeys
; Menu items ---------------
USLOWP:
; ...
Linebreaks have their own science - I would recommend to open a new topic for this question, with a detailed description of the problem (including the code to reproduce it).When I was implementing and testing earlier, I noticed that when I had line breaks in the text contained on the clipboard, pasting the content using they keyboard (<Ctrl-V>) was as expected, but, when any of the AHK paste macros typed the clipboard content, the line breaks were doubled.
The need will probably never come up based on my needs for an alternate paste option, but can this be addressed?
Re: Paste Alternative Script?
Perfect... nice to learn so quickly.
Thanks,
Beverly Howard
Thanks,
Beverly Howard