AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to Unicode//Ascii in a MsgBox???

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Thumpie Bunny Eve
Guest





PostPosted: Mon Mar 16, 2009 12:17 am    Post subject: How to Unicode//Ascii in a MsgBox??? Reply with quote

Assistance please. I am obviously using MsgBox wrong, but i am trying to display the Unicode//Higher Ascii characters for Up arrow, and Down arrow in a message box. And it's not working. Here is what's failed so-far.

(Keep in mind All my AHK scripts are in standard Txt format (ANSI) and i can not simply copy and paste a ↑ or ↓ symbol into the script. )

Code:
#+/::
asc0 = {ASC 08593}
asc1 = {ASC 08595}

MsgBox, 32,CBM.ahk,Keys:`n  [Win]+[ %asc0% ] - Previous Clip`n  [Win]+[ %asc1% ] - Next Clip
;FAILED to display [ ↑ ] or [ ↓ ]

MsgBox, 32,CBM.ahk,Keys:`n  [Win]+[{ASC 08593}] - Previous Clip`n  [Win]+[{ASC 08595}] - Next Clip
;FAILED to display [ ↑ ] or [ ↓ ]

MsgBox % "Keys:`n  [Win]+[". {ASC 8593} ."] - Previous Clip`n  [Win]+[". {ASC 8595} ."] - Next Clip`n
;FAILED to display [ ↑ ] or [ ↓ ]

return


Examples are welcome.
-tbe
Back to top
Thumpie Bunny Eve
Guest





PostPosted: Mon Mar 16, 2009 7:18 pm    Post subject: Bump Reply with quote

Bumped, due to lack of replies, and falling off the bottom of first page as a recent topic. Razz
Back to top
Frankie



Joined: 02 Nov 2008
Posts: 2850

PostPosted: Mon Mar 16, 2009 7:31 pm    Post subject: Reply with quote

Code:
asc0 = {ASC 08593}
asc1 = {ASC 08595}
Should be
Code:
asc0 := Char(08593)
asc1 := Char(08595)


That might fix it but im not sure. I don't this ASCII goes that high.

Edit: Did you mean hex values?
Code:
asc0 := Char(0x08593)
asc1 := Char(0x08595)

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Mar 16, 2009 10:26 pm    Post subject: Reply with quote

you don't need to use unicode to show upwards or downwards arrow.

Code:
msgbox % Chr(24) ; upwards arrow
msgbox % Chr(25) ; downwards arrow, seems problematic


ASCII and Extended table:

Back to top
Thumpie Bunny Eve
Guest





PostPosted: Tue Mar 17, 2009 12:26 am    Post subject: THANK YOU! Reply with quote

<3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3<3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3

This is a very useful reply! and i had totally missed the Chr() command! This is exactly what i was looking for. Your the tops! *^-^*

HEART!
-tbe *^u^*

<3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3<3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3 ♥ <3
Back to top
ProsperousOne



Joined: 19 Sep 2005
Posts: 115

PostPosted: Tue Mar 24, 2009 3:18 pm    Post subject: Reply with quote

I've spent about 2 hours scouring all the posts dealing with Unicode, Unicode2Ansi(), etc.

All I want to do is display some Greek characters in a message box and Gui Rolling Eyes

Seems like there have been may requests for this seeminly simple funciton, but no easy answers.

Here's my best attempt:
Code:
wString := "α" ; greek text to be displayed in message box or GUI

DisplayText := Unicode2Ansi(wString, sString)   ; sString *SHOULD* (I asssume?) be the output (return) value form the funtion

; Greate Gui
Gui, Add, Text, +Center vDisplayText, Text
GuiControl,, DisplayText, %DisplayText%         ; display α character in GUI
Gui, Show, x800 y300 h50 w100, New GUI Window

Msgbox, Unicode Text: %DisplayText%             ; display α character in Msgbox.

Return

Unicode2Ansi(ByRef wString, ByRef sString, CP = 0) ; Code lifted fom the Unicode2Ansi conversion posts
{
     nSize := DllCall("WideCharToMultiByte"
      , "Uint", CP
      , "Uint", 0
      , "Uint", &wString
      , "int",  -1
      , "Uint", 0
      , "int",  0
      , "Uint", 0
      , "Uint", 0)

   VarSetCapacity(sString, nSize)

   DllCall("WideCharToMultiByte"
      , "Uint", CP
      , "Uint", 0
      , "Uint", &wString
      , "int",  -1
      , "str",  sString
      , "int",  nSize
      , "Uint", 0
      , "Uint", 0)
}
Back to top
View user's profile Send private message
ProsperousOne



Joined: 19 Sep 2005
Posts: 115

PostPosted: Thu Mar 26, 2009 1:14 pm    Post subject: Reply with quote

bumpity... Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group