Sign in to follow this  
Followers 0
Dirk98

Selecting O(k) C(ancel) in language verions

22 posts in this topic

Hello guys, I'm new and starting from scratch so bear with my questins pls.

I'm trying to follow the basic examples of AutoIt v3 scripts, and there's a task of sending O or C latters to select Ok or Cancel buttons in a window. Can anyone pls explain (or point me to where to read about it) how to change to my language code, send my language latters that correspond to Ok or Cancel, then return back to English to continue the script as given.

Thanks! :)

Share this post


Link to post
Share on other sites



Hello guys, I'm new and starting from scratch so bear with my questins pls.

I'm trying to follow the basic examples of AutoIt v3 scripts, and there's a task of sending O or C latters to select Ok or Cancel buttons in a window. Can anyone pls explain (or point me to where to read about it) how to change to my language code, send my language latters that correspond to Ok or Cancel, then return back to English to continue the script as given.

Thanks! :)

Rather than swapping Regional/keyboard settings for languages, I'd suggest seeing if ControlClick() in the help file might work for you.


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Rather than swapping Regional/keyboard settings for languages, I'd suggest seeing if ControlClick() in the help file might work for you.

Props to the Monamo man! Good suggestion, and example of using your noodle!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Rather than swapping Regional/keyboard settings for languages, I'd suggest seeing if ControlClick() in the help file might work for you.

Thanks guys, but I'm afraid I'll have to mess with the Regional/keyboard related problem yet almost in every script I come across in the process. So the earlier I take it on now the better. Any serios contra-indication for it?

Thanks a lot again.

Dirk98.

Edited by Dirk98

Share this post


Link to post
Share on other sites

Thanks guys, but I'm afraid I'll have to mess with the Regional/keyboard related problem yet almost in every script I come across in the process. So the earlier I take it on now the better. Any serios contra-indication for it?

I'll admit I'm a bit lost on what you're trying to accomplish by changing the Regional/Keyboard settings. if the Windows version in different than English United States (code 0409) then your Ok and Cancel will not be Ok and Cancel, right? It would be something else and you should use AU3Info to see what is the correct keys to send or what Classes to ControlClick(), ControlSend(), etc. Having to change the Windows language from its current state to 0409 so you can use AutoIt then back to the original language doesn't seem like the smoothest way to accomplish your goal. Regardless search the Help file for @OSLang and @OSLang codes.

Share this post


Link to post
Share on other sites

I'll admit I'm a bit lost on what you're trying to accomplish by changing the Regional/Keyboard settings. if the Windows version in different than English United States (code 0409) then your Ok and Cancel will not be Ok and Cancel, right? It would be something else and you should use AU3Info to see what is the correct keys to send or what Classes to ControlClick(), ControlSend(), etc. Having to change the Windows language from its current state to 0409 so you can use AutoIt then back to the original language doesn't seem like the smoothest way to accomplish your goal. Regardless search the Help file for @OSLang and @OSLang codes.

Thanks, ssubirias3, for the tip on AU3Info. The problem is that Ok and Cancel are different in my language and hitting O or C keys in the script (like it is explained in the introductory example with Notepad) doesnt Saves or Negates or Cancels the Untitled (Yes, No, Cancel buttons). Actually I can indicate ANY keystroke in this script trying to achieve it on my system, but unless I change the codepage first then hit a certain key (one of the 3) in my language, I will be stuck.

I appreciate that the same task can be achieved in dozens of other ways with AutioIt, but I would like to stick to the logic and tools that were used in the original example, adapting it to my language OS as close as possible. Hence the need for messing with language codepage back and forth as I asked in the beginning. You know, trying to learn it.

Thanks.

Dirk.

Share this post


Link to post
Share on other sites

Guys, what does it mean:

Sends simulated keystrokes to the active window.

Send ( "keys" [, flag] )

flag = 1, keys are sent raw.

What is

raw

?

Thanks. :)

Share this post


Link to post
Share on other sites

Some keys have special properties in not-raw mode. Example: Send('^s') is like pressing Ctrl+S. If you use raw mode, it's like typing the ^ character, and the s character.

Share this post


Link to post
Share on other sites

Some keys have special properties in not-raw mode. Example: Send('^s') is like pressing Ctrl+S. If you use raw mode, it's like typing the ^ character, and the s character.

Thanks, Saunders, could you please give an example of the raw mode, how it looks in Send command for '^s' (I understand this is not a raw mode expression?). Thanks.

Share this post


Link to post
Share on other sites

Thanks, Saunders, could you please give an example of the raw mode, how it looks in Send command for '^s' (I understand this is not a raw mode expression?). Thanks.

He just told you what it was. In raw mode it types "^s". When not in raw mode it presses Ctrl+S.

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

ControlFocus("WinTitle","","button1")

ControlClick("WinTitle","","button1")

Have you tried the above?

I scripted part of an installer using the above method which was ran on Japanese systems

Use Au3info to find out what the button numbers are

Share this post


Link to post
Share on other sites

Excellent, got it. ^s is raw already. :)

@ChrisL: will try it right now.

Thanks.

Share this post


Link to post
Share on other sites

Excellent, got it. ^s is raw already. :)

@ChrisL: will try it right now.

Thanks.

Ok, I was stupid of course, it works straight, I can type necessary letters in my lanuge directly in the script and they get all translated same as english equivalents. I'm done with the basic tutorial on notebook and will try out your suggestions, good for learning.

Thanks.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

That's the lowly I meant:

Run("notepad.exe")
WinWaitActive("Áåçûìÿííûé - Áëîêíîò")
Send("This is some text.")
WinClose("Áåçûìÿííûé - Áëîêíîò")
WinWaitActive("Áëîêíîò", "&Äà")
Send("!í")
Edited by Dirk98

Share this post


Link to post
Share on other sites

That's the lowly I meant:

Run("notepad.exe")
WinWaitActive("Áåçûìÿííûé - Áëîêíîò")
Send("This is some text.")
WinClose("Áåçûìÿííûé - Áëîêíîò")
WinWaitActive("Áëîêíîò", "&Äà")
Send("!í")
Can even be reduced to:

Run("notepad.exe")
WinWaitActive("Áåçûìÿííûé - Áëîêíîò")
Send("This is some text.")
WinClose("Áåçûìÿííûé - Áëîêíîò")
Send("í")

Share this post


Link to post
Share on other sites

Rather than swapping Regional/keyboard settings for languages, I'd suggest seeing if ControlClick() in the help file might work for you.

Monamo, I've checked, thanks, it works very well.

Run("notepad.exe")
WinWaitActive("Áåçûìÿííûé - Áëîêíîò")
Send("This is some text.")
WinClose("Áåçûìÿííûé - Áëîêíîò")
WinWaitActive("Áëîêíîò", "&Äà")
ControlClick("Áëîêíîò","&Äà",7)

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Have you tried the above?

I scripted part of an installer using the above method which was ran on Japanese systems

Use Au3info to find out what the button numbers are

ChrisL,

I tried to add your suggested button1 to my little script below:

Run("notepad.exe")
WinWaitActive("Áåçûìÿííûé - Áëîêíîò")
Send("This is some text.")
WinClose("Áåçûìÿííûé - Áëîêíîò")
WinWaitActive("Áëîêíîò", "&Äà")
ControlFocus("Áëîêíîò","&Äà",7)
ControlClick("Áëîêíîò","&Äà",7)

Changed 2 last lines to:

ControlFocus("Áëîêíîò","&Äà","button1")
ControlClick("Áëîêíîò","&Äà","button1")

but it stopped working. In my script above I don't even need the ControlFocus command. What am I doing wrong with this button1 (or 2, doesn't matter, it doesn't work)?

Thanks.

Edited by Dirk98

Share this post


Link to post
Share on other sites

Thanks, ssubirias3, for the tip on AU3Info. .... but I would like to stick to the logic and tools that were used in the original example

Glad to see you've come to realize we have been telling you the same thing. Use AU3Info and ControlClick() or ControlSend() or ControlCommand(). Read up on those if you're not sure how to use them yet. You'll note that ChrisL suggested ControlFocus(), you could use WinActivate() too, since the Remark section of the Control...() functions clearly says

Remarks

Some controls will resist clicking unless they are the active window. Use the WinActivate() function to force the control's window to the top before using Control...()

The Notepad Tutorial you were running through also talks about using AU3Info, so I'm not sure why our suggesting this to you was kinda new. Note the Notepad Tutorial doesn't cover Control...() functions but uses Send(), if you are going to use AU3Info and Control...() functions the information you want is located under the "Control" tab of AU3Info :). If you find that the Control tab is empty (has no information) then that window area isn't a control like ToolbarWindow32, Edit, Button, etc. Likewise, because something isn't a control does not mean you cannot use the Control...() functions on it. That's a little more advance, perhaps for another topic or day.

Again glad to see you've got the stuff working and you decided to trust our answers :). A word to the wise, anyone who appears to ignore the advice of others could find themselves wondering, "why won't anyone give me the answer to my question???"

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