| View previous topic :: View next topic |
| Author |
Message |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Tue Dec 22, 2009 11:27 pm Post subject: |
|
|
Hey jackie,
I built a little GUI that allows me to launch a test script based on the various flavors of AHK exes that are out there now:
| Code: | Gui, Add, Text, x10 y10, Select the AutoHotkey exe to launch.
Gui, Add, Dropdownlist, xp yp+20 vtype, AutoHotkey||AutoHotkey_L|AutoHotkeyU
Gui, Add, Button, xp+135 yp-1 gLaunch, OK
Gui, Show, AutoSize Center, AHK.exe Launcher
return
Launch:
Gui, Submit
if !type
return
Gui, Destroy
Run, % """C:\AutoHotkey\" type ".exe"" ""C:\Documents and Settings\sinkfaze\Desktop\Test.ahk"""
return
GuiCancel:
GuiClose:
Gui, Destroy
ExitApp |
I just recently tried running a code sample from the AutoHotkey_L documentation through my test script via the GUI:
| Code: | array := Object()
array["a"] := "alpha"
array["b"] := "bravo"
MsgBox % array["a"] . " " . array["b"] |
Using AutoHotkey_L.exe the code runs fine, but when I try to use the latest version of AutoHotkeyU.exe I get this error:
| Code: | The following variable name contains an illegal character:
"array["a"]"
The program will exit. |
I couldn't see anything obvious in my own scripting but I could be wrong. In your build are the components of AHK_L supposed to be fully integrated and/or supported at this point? _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
jackieku
Joined: 30 Nov 2008 Posts: 67
|
Posted: Wed Dec 23, 2009 12:36 am Post subject: |
|
|
| sinkfaze wrote: | | Code: | array := Object()
array["a"] := "alpha"
array["b"] := "bravo"
MsgBox % array["a"] . " " . array["b"] |
|
Are you sure that was an error of AutoHotkeyU? The above codes works fine here. |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Wed Dec 23, 2009 6:27 am Post subject: |
|
|
How weird, I just tested it on my other computer and it works fine as well. I'll check for other problems on my other computer, sorry to interrupt your thread for a non-issue! _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
fincs
Joined: 05 May 2007 Posts: 470 Location: Seville, Spain
|
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Wed Dec 23, 2009 1:53 pm Post subject: |
|
|
| fincs wrote: | | sinkfaze: Make sure you're using the latest version of AutoHotkeyU. Older versions didn't have object support. |
Yeah, I had just downloaded the zip for the latest version to my other computer but I hadn't noticed that it didn't unzip the files to the right directory so it never overwrote the previous version. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
foxer
Joined: 23 Dec 2009 Posts: 5
|
Posted: Sat Dec 26, 2009 1:02 am Post subject: |
|
|
Hello,
Thanks for this Unicode version.
Let me fill a bug report:
This won't work:
<^>!+é::Send É
<^>!+ç::Send Ç
It would rather show ╔ and Ã
So, I need to write this instead:
<^>!+é::Send {ASC 0201}
<^>!+ç::Send {ASC 0199}
This happens no matter how the command file is encoded (UTF-8 or 16LE), no matter if you use Send or SendInput.
However, other characters are shown correctly (œŒăĂ etc.): "Send œ" etc.
Edit: I use this script since I have é and ç on my keyboard, but not É and Ç. "Send É", etc. works with the official AutoHotKey.
Last edited by foxer on Sat Dec 26, 2009 8:27 am; edited 1 time in total |
|
| Back to top |
|
 |
jackieku
Joined: 30 Nov 2008 Posts: 67
|
Posted: Sat Dec 26, 2009 2:11 am Post subject: |
|
|
| foxer wrote: | This won't work:
<^>!+é::Send É
<^>!+ç::Send Ç
It would rather show ╔ and Ã
etc. |
Ç(U+00C7) and É(U+00C9) are both in the range between U+0080 and U+00FF. Both of them are valid virtual key codes, so in programming level there might be no way to know either the "character" or the "key code" should be sent. I know it should be a problem for the European users, but I'm not able to fix it currently because I don't have the knowledge about those languages and keymaps. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4462 Location: Qld, Australia
|
Posted: Sat Dec 26, 2009 4:24 am Post subject: |
|
|
| Quote: | | ... there might be no way to know either the "character" or the "key code" should be sent. | Send accepts a string of text; possibly with modifiers and {key names} interspersed, but never a raw array of virtual keycodes. Afaik, only 0-9 and A-Z have virtual keycodes matching their ASCII values, so you should not be interpreting anything else directly as a virtual keycode. (Actually, I think AutoHotkey does not directly interpret even those characters.)
VkKeyScanEx is used (via CharToVKAndModifiers <- TextToVK <- SendKeys in keyboard_mouse.cpp) to translate each character into a virtual keycode/modifier combination. If that fails, SendASC is used (via SendKeySpecial) to send the character. Perhaps it would be better to call SendUnicodeChar from SendKeySpecial than having two virtually identical sections for it in SendKeys. In your commit 3804d380.., they are at line 618 and line 710 of keyboard_mouse.cpp. |
|
| Back to top |
|
 |
jackieku
Joined: 30 Nov 2008 Posts: 67
|
Posted: Sat Dec 26, 2009 5:25 am Post subject: |
|
|
@Lexikos
Hmm, I'll make SendKeySpecial use SendUnicodeChar, hope it won't break anything. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4462 Location: Qld, Australia
|
Posted: Sat Dec 26, 2009 7:12 am Post subject: |
|
|
SendKeySpecial is only used for individual characters which have no corresponding vk+modifiers. It uses Alt+Numpad, which seems to generate a WM_CHAR message (in Notepad/Edit control at least). I presume the majority of applications use WM_CHAR, not the individual Alt+Numpad key-presses. SendInput in Unicode mode also generates a WM_CHAR message, so it will probably work just as well but without the extra key-presses. If it is used on an ANSI window, the character is translated automatically.
Anyway, I meant to suggest that SendKeySpecial be used only in the same situations as before, except that TextToVK is given an opportunity to translate the character first (in both sections). Thinking more about it, this wouldn't have solved the problem as those characters are not > 255. If you have any concern about backward-compatibility, I suggest you change SendKeySpecial as follows:
- Use SendUnicodeChar for characters > 255.
- Use SendASC for characters 0..255.
- Change the following line to work correctly when aChar is a wide char.
| Code: | if (aChar < 0) // Try using ANSI.
*cp++ = '0'; // ANSI mode is achieved via leading zero in the Alt+Numpad keystrokes. | It was meant to detect whether aChar is outside the range 0..127, but only works if aChar is a signed 8-bit integer (char).
Btw...
| Quote: | Windows versions based on DOS (Win9x/ME) are not supported.
Source: Wiki: AutoHotkeyU | Visual C++ 2008 does not support Windows NT either. See Visual C++ Breaking Changes. Since your solution file says "Visual Studio 2008", I presume you also compile with 2008. I guess this means that AutoHotkeyU and _L will run only on platforms where SendInput is present and supports the Unicode flag.  |
|
| Back to top |
|
 |
jackieku
Joined: 30 Nov 2008 Posts: 67
|
Posted: Sat Dec 26, 2009 7:51 am Post subject: |
|
|
| Lexikos wrote: | | SendKeySpecial is only used for individual characters which have no corresponding vk+modifiers. |
So is it needed to send the characters < 255 by SendASC instead of SendUnicodeChar?
| Quote: | Visual C++ 2008 does not support Windows NT either. See Visual C++ Breaking Changes. Since your solution file says "Visual Studio 2008", I presume you also compile with 2008. I guess this means that AutoHotkeyU and _L will run only on platforms where SendInput is present and supports the Unicode flag.  |
I think the source codes might be able to be compiled by VS2005 or VS2003? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4462 Location: Qld, Australia
|
Posted: Sat Dec 26, 2009 8:31 am Post subject: |
|
|
| jackieku wrote: | | So is it needed to send the characters < 255 by SendASC instead of SendUnicodeChar? | I don't think so, unless you're allowing for Win9x/NT.
| Quote: | | I think the source codes might be able to be compiled by VS2005 or VS2003? | That's possible, but how many users have VS2005 or VS2003? I was thinking about the more generally available binaries. Is there some other reason it couldn't be run on/compiled for Win9x? (I'm curious, but don't really care to be honest.) |
|
| Back to top |
|
 |
foxer
Joined: 23 Dec 2009 Posts: 5
|
Posted: Sat Dec 26, 2009 8:35 am Post subject: |
|
|
| jackieku wrote: | | Ç(U+00C7) and É(U+00C9) are both in the range between U+0080 and U+00FF. |
Thanks for the quick answer and glad to see there might be progress with that.
But as I mentioned, Send works with other characters within the same range you mentioned. For instance:
<^>!o::Send œ
<^>!+o::Send Œ
They are still U+009C and U+008C! |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4462 Location: Qld, Australia
|
Posted: Fri Jan 15, 2010 9:39 am Post subject: |
|
|
FileRead doesn't seem to work with FileEncoding UTF-16-RAW. Windows XP/Server 2003's Backup utility creates "backup selection files" (.bks) in this format. Fortunately, they can be read using FileRead *c filename or with Loop, Read.
Edit: FileRead *c sets the variable's "length" to twice what it should be.
| Code: | | output_var.SetCharLength(is_binary_clipboard ? (bytes_actually_read - 1) | script2.cpp @ line 9070 |
|
| Back to top |
|
 |
fincs
Joined: 05 May 2007 Posts: 470 Location: Seville, Spain
|
Posted: Fri Jan 15, 2010 8:11 pm Post subject: |
|
|
Um...
| Code: | #ifndef CONFIG_WIN9X
bool IsWin95(void) {return false;}
bool IsWin98(void) {return false;}
bool IsWinMe(void) {return false;}
bool IsWin95orLater(void) {return true;}
bool IsWin98orLater(void) {return true;}
bool IsWinMeorLater(void) {return true;} |
_________________ fincs
SciTE4AutoHotkey v2 script editor
[AutoHotkeyCE] [AutoHotkeyU] |
|
| Back to top |
|
 |
|