Press variable name within subroutine, can't get it work

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Dick99999
Pro Scripter
Posts: 84
Joined: Thu Nov 27, 2008 10:25 am
Location: Netherlands

Press variable name within subroutine, can't get it work

Post by Dick99999 » Thu Aug 04, 2022 7:53 am

I cannot get the following script to work. The shiftKey_Var_1 variable is set to the right value, but nothing appears to happen in the notepad window.
Any suggestion?

//
setfocus>t.txt*
gosub>shiftKey,LF
Exit

srt>shiftKey
press shift
let>PRESS_ALLOWVARS=1
press shiftKey_Var_1
let>PRESS_ALLOWVARS=0
release shift
Wait>0.1
END>shiftKey

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Press variable name within subroutine, can't get it work

Post by Dorian (MJT support) » Thu Aug 04, 2022 10:02 am

It looks to me like the subroutine/variable issue may be a red herring.

LF is not in the list of accepted Press commands. You can Send>LF though.

If I simply try the following, nothing happens :

Code: Select all

setfocus>*Untitled*
press LF
Whereas if I use a subroutine for Press Enter, it works :

Code: Select all

setfocus>*Untitled*
gosub>shiftKey,Enter

srt>shiftKey
let>PRESS_ALLOWVARS=1
Press shiftKey_Var_1
let>PRESS_ALLOWVARS=0
Wait>0.1
END>shiftKey
Yes, we have a Custom Scripting Service. Message me or go here

Dick99999
Pro Scripter
Posts: 84
Joined: Thu Nov 27, 2008 10:25 am
Location: Netherlands

Re: Press variable name within subroutine, can't get it work

Post by Dick99999 » Thu Aug 04, 2022 11:46 am

Thanks, indeed with Enter it works. And my mistake to make a simple test! The issue is that I needed a shift TAB, however Notepadd++ does not record a shift Tab, so it is being send after all.

I am a bit confused what to use in the Press command: Key names and/or System Variables? The latter lists, for example:
CR Crriage Return
LF Line Feed
CRLF Carriage Return, Line Feed Combination (to force a new line)
TAB Tab character

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Press variable name within subroutine, can't get it work

Post by Dorian (MJT support) » Thu Aug 04, 2022 12:15 pm

This gives me a Shift+Tab in Notepad++

Code: Select all

setfocus>*new 3*
gosub>shiftKey,TAB

srt>shiftKey
press shift
let>PRESS_ALLOWVARS=1
Press shiftKey_Var_1
let>PRESS_ALLOWVARS=0
release shift
Wait>0.1
END>shiftKey
Or am I misunderstanding?

EDIT: The following is a complete list of all commands you can use with Press is here.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts