Jump to content

Recommended Posts

Posted
17 minutes ago, Nine said:

Yes

Maybe I misunderstand you. With AutoItSetOption("SendCapslockMode", 0) and {CAPSLOCK on} it works.

Or try to insert this :

Global $WshShell = ObjCreate("WScript.Shell")
AutoItSetOption("SendCapslockMode", 0) ; 0=ignore
$WshShell.SendKeys("{CAPSLOCK}")
Send("1")
Sleep(500)
$WshShell.SendKeys("{CAPSLOCK}")
Send("1")
Sleep(500)

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted
13 hours ago, Musashi said:

Yes, or use $SEND_DEFAULT as second parameter - just to make it 'visual', even if it is not necessary ([optional], default=0).

To enable CAPSLOCK for multiple Send commands, you can use AutoItSetOption("SendCapslockMode", 0)

#include <AutoItConstants.au3>
#include <WinAPISys.au3>

Global $hWnd, $iDelay = 300

Run("notepad.exe")
If @error Then
    ConsoleWrite("! >>> Error running Notepad" & @CRLF)
    Exit
EndIf

$hWnd = WinWaitActive("[CLASS:Notepad]", "", 5) ; wait 5 seconds for the Notepad window to appear.
If WinExists($hWnd) Then
    ConsoleWrite("+ >>> Notepad-Window exists" & @CRLF)
Else
    ConsoleWrite("! >>> Notepad-Window not exists" & @CRLF)
    Exit
EndIf

; >>> sending keys :
AutoItSetOption("SendCapslockMode", 0) ; 0=ignore


Send(">>> Tests with function Send <<< : {ENTER}", $SEND_DEFAULT)

Send("+1", $SEND_DEFAULT) ; (press 1 while holding SHIFT ==> Result = ! )
Send("{ENTER}", $SEND_DEFAULT) ; *** new line
Sleep($iDelay)

; -> {CAPSLOCK on}
Send("{CAPSLOCK on}", $SEND_DEFAULT) ; (activate CAPSLOCK)
Sleep($iDelay)
Send("1", $SEND_DEFAULT) ; (press 1 while {CAPSLOCK on} ==> Result =  ! )
Send("{ENTER}", $SEND_DEFAULT) ; *** new line
Sleep($iDelay)

Send("+1", $SEND_DEFAULT) ; (press 1 while holding SHIFT -> {CAPSLOCK on} ==> Result =  1
Send("{ENTER}", $SEND_DEFAULT) ; *** new line
Sleep($iDelay)

; -> {CAPSLOCK off}
Send("{CAPSLOCK off}", $SEND_DEFAULT) ; (deactivate CAPSLOCK)
Sleep($iDelay)

Send("+1", $SEND_DEFAULT) ; (press 1 while holding SHIFT ==> Result = ! )
Send("{ENTER}", $SEND_DEFAULT) ; *** new line
Sleep($iDelay)

Send(">>> End <<<{ENTER}", $SEND_DEFAULT)

WinClose($hWnd)

; to answer the "Save Question" automatically, activate the following lines :
;~ WinWaitActive("[CLASS:#32770]")
;~ Sleep(500)
;~ Send("{TAB}{ENTER}")

 

Thank you for your help but Notepad is not the original application I was trying to control.  If you take a look at my original post, I was unable to send the SHIFT+1 to the said App.  I am able to set the focus to the window in question and the next step would be to Send the combination of the SHIFT+1 keys in other words, hold down SHIFT and press 1.  Would greatly appreciate ur insights.

Thx again

Posted
1 hour ago, ITO said:

... but Notepad is not the original application I was trying to control.  If you take a look at my original post, I was unable to send the SHIFT+1 to the said App.

I know Notepad isn't the application you're trying to control, but we needed a standard test environment. Me (and probably @Nine too) don't know how your app "Level II" looks like or works. Could you post a screenshot?

It may work with ControlSend and the parameter controlID (in addition to the title/handle of the window). The controlID can be detected using the "AutoIt Window Info Tool" (depending on the type of your app).

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted
On 12/7/2019 at 9:59 AM, Musashi said:

I know Notepad isn't the application you're trying to control, but we needed a standard test environment. Me (and probably @Nine too) don't know how your app "Level II" looks like or works. Could you post a screenshot?

It may work with ControlSend and the parameter controlID (in addition to the title/handle of the window). The controlID can be detected using the "AutoIt Window Info Tool" (depending on the type of your app).

Thank u for ur help.  I found the issue.. the problem was the rights...Once I started VS Code w/ Admin rights...it worked ... thx again

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...