Jump to content

ControlSend & national keyboard - problem


 Share

Recommended Posts

I have national keyboard as you can see on this picture:

this picture only show my keyboard lay-out, nothing nonstandard programs.

And when I'm trying send keys to "Open file" dialog:

...
$directory_name = 'C:\111\PRO_EXE\2006-05-28_VELKE\WORK888'
ControlSend('Open file','','Edit1',$directory_name,1) ; 1 = raw mode
...
oÝ÷ Ú)å¢méâø«²Ùh¢­ßÛ)©Ý{)¶«z+,z{Óݾûí=Úè{´÷m¼ß6ßvó{ÞG´÷l(®D¨²"±ÈZ졪ݱéÝx+¢ëbæ§vG²±ªÞ±éÝx-º.Ú¶*'jYɺ­Ö¥²§­¬&¡×z·¢³hé²)r^j[(Â+ar¦z{^vÚò¢ëljëh×6  Vypis('Vlastni import ...')
    WinActivate(" - PowerBuilder", "") ; kvuli ControlGetFocus()
    
    For $i = 1 to UBound($knihovny) - 1 ; loop through libraries
        Opt ("WinTitleMatchMode", 2)     ;1=start, 2=subStr, 3=exact, 4=...
        $knihovna = StringLower($knihovny[$i]) & '.pbl'
        If Not OznacPbl($knihovny[$i]) Then Return UkonciImport('Danou knihovnu nelze oznacit v TreeView!' & @CRLF & $knihovna)
        
        AdlibEnable("AdlibImport", 300) ; vyskakovaci okna testovat 3x za sekundu
        
        ControlFocus (" - PowerBuilder", "", "PBTreeView32_801")
        WinMenuSelectItem(" - PowerBuilder", "", '&Entry', '&Import...')

        Opt ("WinTitleMatchMode", 3)     ;1=start, 2=subStr, 3=exact, 4=...
        WinWaitActive("Select Import Files")

        Vypis($knihovna & ' ...')
        
;~      ControlSend("Select Import Files", "", "Edit1",'{SHIFTDOWN}{SHIFTUP}') ; u druheho cyklu bylo (nevim proc) stisknute Shift
        ControlSend("Select Import Files", "", "Edit1", $adresar & '\' & $knihovny[$i], 1) ; raw rezim, kdyby nahodou jmeno adresare obsahovalo !^+#
;~      Sleep(5000)
        ControlSend("Select Import Files", "", "Edit1", '{Enter}') ; prepne se do daneho adresare - change to this directory
;~      ControlClick("Select Import Files", "", "Button2") ; prepne se do daneho adresare (tl. Otevrit)
        
;~      Sleep(3000)
        ControlSend("Select Import Files", "", "SysListView321", '^a{Enter}') ; oznaci vsechny a impl. tl. Otevrit - select all and Open
        Opt ("WinTitleMatchMode", 2)     ;1=start, 2=subStr, 3=exact, 4=...

        Sleep(250)
        ; pockat az se import dokonci (az treeview dostane zpatky focus)
        While ControlGetFocus(" - PowerBuilder") <> "PBTreeView32_801"
          Sleep(250)
        Wend

        Sleep(250)
        AdlibDisable()

        If $adlib_byla_chyba Then Return UkonciImport($adlib_text_chyby)
        
        Vypis($knihovna & ': OK')
    Next
oÝ÷ ØÚ-{MúiÚÞ±ªÚýÓÝ·õ©©Ó~¤(h¾|´ß¨

EDIT: typos and some completion

Sometimes it looks like Shift is pressed or keyboard layout is changed during some stage of ControlSend

like in this screenshot:

It should look like this:

I'm testing this on WINXP Pro SP2 Czech

EDIT2:

unfortunatelly I can't simulate it on other standard Open file dialogs,

so I can't post some small testing script for it :)

EDIT3:

Maybe it can be important for that problem:

I'm automatizing PowerBuilder import source files into libraries (in cycle)

and my script has GUI with $HWND_TOPMOST atribute set to ON.

EDIT4:

I found that some users have the same Problems with ControlSend but it seems they didn't solve it - it's maybe AutoIt bug.

They only found workaround for it: instead of ControlSend() use ControlSetText()

EDIT5:

Another workaround is to GetKeyboardLayout/SetKeyboardLayout like in these topics:

http://www.autoitscript.com/forum/index.ph...ost&p=84073

http://www.autoitscript.com/forum/index.ph...ost&p=84092

EDIT6:

I found another post with explanation!! :whistle:

ControlSend does not send any character produced with the SHIFT key.

http://www.autoitscript.com/forum/index.ph...ost&p=81526

and there is also UDF for workaround it:

http://www.autoitscript.com/forum/index.ph...ost&p=81531

I think this sentence:

ControlSend does not send any character produced with the SHIFT key.

could be in AutoIt HelpFile in Remarks for ControlSend function !!!

Edited by Zedna
Link to comment
Share on other sites

I have national keyboard as you can see on this picture:

this picture only show my keyboard lay-out, nothing nonstandard programs.

And when I'm trying send keys to "Open file" dialog:

...
$directory_name = 'C:IPRO_EXE€6-05-28_VELKEWORK888'
ControlSend('Open file','','Edit1',$directory_name,1) ; 1 = raw mode
...
 oÝ÷ Ú)å¢méâø«²Ùh¢­ßÛ)©Ý{)¶«z+,z{Óݾûí=Úè{´÷m¼ß6ßvó{ÞG´÷l(®D¨²"±ÈZ졪ݱéÝx+¢ëbæ§vG²±ªÞ±éÝx-º.Ú¶*'jYɺ­Ö¥²§­¬&¡×z·¢³hé²)r^j[(Â+ar¦z{^vÚò¢ëljëh×6    Vypis('Vlastni import ...')
    WinActivate(" - PowerBuilder", "") ; kvuli ControlGetFocus()
    
    For $i = 1 to UBound($knihovny) - 1 ; loop through libraries
        Opt ("WinTitleMatchMode", 2)     ;1=start, 2=subStr, 3=exact, 4=...
        $knihovna = StringLower($knihovny[$i]) & '.pbl'
        If Not OznacPbl($knihovny[$i]) Then Return UkonciImport('Danou knihovnu nelze oznacit v TreeView!' & @CRLF & $knihovna)
        
        AdlibEnable("AdlibImport", 300) ; vyskakovaci okna testovat 3x za sekundu
        
        ControlFocus (" - PowerBuilder", "", "PBTreeView32_801")
        WinMenuSelectItem(" - PowerBuilder", "", '&Entry', '&Import...')

        Opt ("WinTitleMatchMode", 3)     ;1=start, 2=subStr, 3=exact, 4=...
        WinWaitActive("Select Import Files")

        Vypis($knihovna & ' ...')
        
;~   ControlSend("Select Import Files", "", "Edit1",'{SHIFTDOWN}{SHIFTUP}') ; u druheho cyklu bylo (nevim proc) stisknute Shift
        ControlSend("Select Import Files", "", "Edit1", $adresar & '' & $knihovny[$i], 1) ; raw rezim, kdyby nahodou jmeno adresare obsahovalo !^+#
;~   Sleep(5000)
        ControlSend("Select Import Files", "", "Edit1", '{Enter}') ; prepne se do daneho adresare - change to this directory
;~   ControlClick("Select Import Files", "", "Button2") ; prepne se do daneho adresare (tl. Otevrit)
        
;~   Sleep(3000)
        ControlSend("Select Import Files", "", "SysListView321", '^a{Enter}') ; oznaci vsechny a impl. tl. Otevrit - select all and Open
        Opt ("WinTitleMatchMode", 2)     ;1=start, 2=subStr, 3=exact, 4=...

        Sleep(250)
        ; pockat az se import dokonci (az treeview dostane zpatky focus)
        While ControlGetFocus(" - PowerBuilder") <> "PBTreeView32_801"
          Sleep(250)
        Wend

        Sleep(250)
        AdlibDisable()

        If $adlib_byla_chyba Then Return UkonciImport($adlib_text_chyby)
        
        Vypis($knihovna & ': OK')
    Next
 oÝ÷ ØÚ-{MúiÚÞ±ªÚýÓÝ·õ©©Ó~¤(h¾|´ß¨

EDIT: typos and some completion

Sometimes it looks like Shift is pressed or keyboard layout is changed during some stage of ControlSend

like in this screenshot:

It should look like this:

I'm testing this on WINXP Pro SP2 Czech

EDIT2:

unfortunatelly I can't simulate it on other standard Open file dialogs,

so I can't post some small testing script for it :)

EDIT3:

Maybe it can be important for that problem:

I'm automatizing PowerBuilder import source files into libraries (in cycle)

and my script has GUI with $HWND_TOPMOST atribute set to ON.

EDIT4:

I found that some users have the same Problems with ControlSend but it seems they didn't solve it - it's maybe AutoIt bug.

They only found workaround for it: instead of ControlSend() use ControlSetText()

EDIT5:

Another workaround is to GetKeyboardLayout/SetKeyboardLayout like in these topics:

http://www.autoitscript.com/forum/index.ph...ost&p=84073

http://www.autoitscript.com/forum/index.ph...ost&p=84092

EDIT6:

I found another post with explanation!! :whistle:

ControlSend does not send any character produced with the SHIFT key.

http://www.autoitscript.com/forum/index.ph...ost&p=81526

and there is also UDF for workaround it:

http://www.autoitscript.com/forum/index.ph...ost&p=81531

I think this sentence:

ControlSend does not send any character produced with the SHIFT key.

could be in AutoIt HelpFile in Remarks for ControlSend function !!!

Why all peoples on AutoIt forum first adds new topic and then go searching forum for similar topics? :)

i542

EDIT:

prepne se do daneho adresare

? I didn't understand you. Edited by i542

I can do signature me.

Link to comment
Share on other sites

  • Moderators

Why all peoples on AutoIt forum first adds new topic and then go searching forum for similar topics? :whistle:

That was to show that he done plenty of research on the issue before just posting BS.

EDIT: ? I didn't understand you.

Now you know how we feel when you post something :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Why all peoples on AutoIt forum first adds new topic and then go searching forum for similar topics? :whistle:

i542

EDIT: ? I didn't understand you.

I'm not newbie and I spent much time/tryout with this problem code,

but you are right that I could search in forum first of all, sorry for that :)

My script code is in Czech language, also my commnets and I added some english translations into it (for this post) but only to important piece of code.

***

I used workaround with ControlSetText() instead of ControlSend(), so my script is now working,

but question about AutoIt & ControlSend() problems remain, so I posted this issue also in Bug reports forum:

HelpFile - Remarks for ControlSend() - missing important info

I composed this topic also with links to other threads for other users and for me as guide post about this problem and it's explanations/workarounds.

Link to comment
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
 Share

  • Recently Browsing   0 members

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