Jump to content

Recommended Posts

  • Developers
Posted

It works fine and simply overrides all the selected text, so the old OK is replaced by the new OK. ;)

try:

Run("notepad.exe")
sleep(1000)
Send("OK")
sleep(1000)
Send("^a")
send("^c")
Send("{right}")
send("^v")

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Another good example of what not to use Send and MouseClick. ;)

Try this instead :

Run("notepad.exe")
$hWnd = WinWait("[CLASS:Notepad]")
ControlSetText($hWnd, "", "Edit1", "OK")
Sleep(2000) ; time for you to see the text
ControlSetText($hWnd, "", "Edit1", "New Text")

 

Posted

The problem perhaps is with your keyboard layout set by default, as i see it (from your screenshot), you have Russian system, so probably the default keyboard layout is Russian, to fix it use this (set English as default at start, and reset to the previous one at the end):

#include-once
#include <WinAPIEx.au3>

Global $iKbrdLayout, $aKbrdLayouts
OnAutoItExitRegister('__HotKeySendFix_OnExit')

__HotKeySendFix_OnStart()



Run("notepad.exe")
sleep(1000)
Send("OK")
sleep(1000)
Send("^a")
send("^c")
send("^v")


Func __HotKeySendFix_OnStart()
    $iKbrdLayout = 0x0409 ;English
    $aKbrdLayouts = _WinAPI_GetKeyboardLayoutList()
    _WinAPI_LoadKeyboardLayout($iKbrdLayout, $KLF_ACTIVATE)
EndFunc

Func __HotKeySendFix_OnExit()
    For $i = 1 To Ubound($aKbrdLayouts) - 1
        If Hex($iKbrdLayout) = Hex('0x' & StringRight($aKbrdLayouts[$i], 4)) Then
            Return
        EndIf
    Next
    
    _WinAPI_UnloadKeyboardLayout($iKbrdLayout)
EndFunc

 

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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...