Sign in to follow this  
Followers 0

Better usage of "Send"

2 posts in this topic

I have a simple script to run Windows MSPaint (renamed _mspaint.exe here) and set the print option to "Fit to 1 page x 1 page" when Paint opens. This works OK, but the "Page Setup" dialog window flashes up. I'm unsure if keystrokes should be passed to this dialog window, or the main "untitled - Paint" window. Also, this will only work for a new file, not an existing one - where the window title will be "filename - Paint".

What is the correct method to send keystrokes to a dialog such as this please? Also, is this the right way to hide the app during Send operations?

Dim $Program, $PID, $i, $params

    if $CmdLine[0] > 0 Then
        for $i = 1 to $CmdLine[0]
            $params = $params & " " & $CmdLine[$i]
    $Program = "C:\WINDOWS\system32\_mspaint.exe" & $params
    $PID = Run($Program, "", @SW_HIDE)
    WinActivate("untitled - Paint")
    Send("!fu!F{TAB}1{TAB}1{ENTER}");dialog flashes up here
    WinSetState("untitled - Paint", "", @SW_SHOW)


Share this post

Link to post
Share on other sites


have a look at macros and Opt like WinTitleMatchMode and at the ControlCommands like ControlSend.

So long,

Mega :lmao:

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0