Commands & Syntax > Commands > Text & Variable Manipulation >

www.perfectkeyboard.com

 

INSERT to active application - < varout >() ... [Pro]

 

Variable INSERT to active application
<varout>("Variable",Text insertion method)
Available in: Professional edition

Sends (outputs) variable's value to the active window as a sequence of keystrokes or through the clipboard.

 

#

Parameter name

Parameter description

1

Variable

Variable to send out.

2

Text insertion method

If 0, the variable content is send to the active window the way it is defined in program settings ("Options" dialog box - click "Tools/Options" menu command). If 1, the variable value is send to the active window through the clipboard. If 2, the variable value is send to the active window as a sequence of keyboard keystrokes.

 

Example (Macro Steps):

 

1

<#> <#> This macro demonstrates use of command

2

<#> <#> The macro activates Notepad and writes a text in it.

3

Macro execution: ONLY COMMANDS

4

IF WINDOW "Notepad" Is Open (Match=Partial)

5

Window ACTIVATE bring "Notepad" window to top (other parameters: Match = Partial, Window state = Normal, %p4_name = no)

6

WAIT FOR Object = "WIN", Event = "ACT", Parameter = "Notepad", Timeout (seconds) = "5", Exact = "0"

7

IF WINDOW "Notepad" Is Active (Match=Partial)

8

Variable SET "vText=This is Notepad", Message text=""

9

Variable INSERT to active application "vText", Text insertion method="Default (as defined in settings)"

10

ENDIF

11

ELSE activate

12

Message SHOW "" : "Notepad is not running." (other parameters: x = 100, y = 100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

13

ENDIF

Example (Plain Text):

 

<#> This macro demonstrates use of <varout> command

<#> The macro activates Notepad and writes a text in it.

<#>

<cmds>

<if_win>("Notepad","OPEN",0)

   <actwin>("Notepad",0,0,"no")

   <waitfor>("WIN","ACT","Notepad",5,0)

   <if_win>("Notepad","ACT",0)

      <varset>("vText=This is Notepad","")

      <varout>("vText",0)

   <endif>

<else>

   <msg>(100,100,"Notepad is not running.","Message",1)

<endif>)