Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

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


  • Please log in to reply
7 replies to this topic
Thumpie Bunny Eve
  • Guests
  • Last active:
  • Joined: --
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. )

#+/::
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

Thumpie Bunny Eve
  • Guests
  • Last active:
  • Joined: --
Bumped, due to lack of replies, and falling off the bottom of first page as a recent topic. :p

Frankie
  • Members
  • 2930 posts
  • Last active: Feb 05 2015 02:49 PM
  • Joined: 02 Nov 2008
asc0 = {ASC 08593}
asc1 = {ASC 08595}
Should be
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?
asc0 := Char([color=red]0x[/color]08593)
asc1 := Char([color=red]0x[/color]08595)

aboutscriptappsscripts
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run

  • Guests
  • Last active:
  • Joined: --
you don't need to use unicode to show upwards or downwards arrow.

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

ASCII and Extended table:
Posted Image
Posted Image

Thumpie Bunny Eve
  • Guests
  • Last active:
  • Joined: --
<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

ProsperousOne
  • Members
  • 115 posts
  • Last active: Mar 12 2011 09:15 PM
  • Joined: 19 Sep 2005
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 :roll:

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

Here's my best attempt:
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)
}


ProsperousOne
  • Members
  • 115 posts
  • Last active: Mar 12 2011 09:15 PM
  • Joined: 19 Sep 2005
bumpity... :wink:

FlintW
  • Members
  • 2 posts
  • Last active: Nov 13 2015 07:22 AM
  • Joined: 28 Oct 2015

I have found a quick and easy way to integrate the ASCII symbols without any functions, which worked for me. Need some testing on other machines.

 

Open your AHK-Script in Notepad. Click on "Save as...", choose "Unicode" in the dropdown menu next to the save button and save.

 

You should now see some ASCII art in your MsgBox or FileReadFolder or anything text relevant.

 

Flint