Commands & Syntax > Commands > Window Manipulation >

ACTIVATE - < actwin >() ... [Free]

www.perfectkeyboard.com

 

Window ACTIVATE
<actwin>("Window",Match,Window state)
Available in: Free edition

Activates specified window. If the window doesn't exist a macro can be started (to open desired application or notify user, for example).

 

#

Parameter name

Parameter description

1

Window

Window identifier in form of Window Identification Path (WIP) or HWND. It identifies the window that is to be activated.

2

Match

Takes effect only if a window is identified using WIP parameter. Can be one of these values:
0 - match substrings in WIP
1 - match exact strings in WIP

3

Window state

State of the window after the window is activated: 0 - Normal 1 - Minimized 2 - Maximized 3 - Let the state unchanged

 

Example (Macro Steps):

 

1

<#> <#> This macro activates "Notepad" window if it is opened

2

Macro execution: ONLY COMMANDS

3

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

4

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

5

ELSE activate

6

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

7

ENDIF

Example (Plain Text):

 

<#> This macro activates "Notepad" window if it is opened

<#>

<cmds>

 

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

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

<else>

   <msg>(100,100,"'Notepad' is not opened!","Message",1)

<endif>