Monday, September 16, 2019

#1 2019-04-18 06:27:29 am

bulletinki
Member
Registered: 2019-03-25
Posts: 3

Help with ascii art

I was trying to make an Applescript version of Zelda, and I made this neat logo in TextEdit, but when I put it into Applescript, I get this error message,

Expected “"” but found unknown token.



Applescript:

display dialog "Welcome to...
_________________
| /
| _________ / THE LEGEND OF
| / / \ / / __________ _____ ______ ___
|/ /____/ / \ _____ |\ / \ _ \ \ \
/\ / / | | \| | | | | \ \ / _ \
/ \ / / | | | | | | \ \ / / \ \
/____/ /_\ | |_____/| | | | | | | / /___\ \
/ / | _____ | | | | | | | | ___ |
/ / | | \| | | | | | | | / \ |
/ / _ | | | | | | / / | | | |
/ / /| | |_____/| | |_____/| | |_/ / | | | |
/ /________/ |/_________|/_________|/_____/ /___\ /___\
/ |
/________________|
                    "
buttons {"Play", "Quit"} default button 1

if the button returned of the result is "Play" then

Please open it in the editor to see the actual ascii art, the formatting got lost when I tried to paste it in.


how did i get here i am not gud with computr


Filed under: ASCII

Offline

 

#2 2019-04-18 06:57:03 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5889

Re: Help with ascii art

The backslash (\) is an escaping character in AppleScript code -- it can only be used before certain other characters (n, r, t, ", or a second \). But if you change each instance of \ to \\, it will look odd in code but fine in the resulting dialog.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2019-04-18 07:07:49 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3576

Re: Help with ascii art

The problem is linked to the character "\".

A global Search and Replace task replacing “\” by “" & character id 92 & "”
gives a script which compiles but, as your design rely upon a fixed width font, the dialog doesn't match your needs.

Applescript:

display dialog "Welcome to...
_________________
| /
| _________ / THE LEGEND OF
| / / "
& character id 92 & " / / __________ _____ ______ ___
|/ /____/ / "
& character id 92 & " _____ |" & character id 92 & " / " & character id 92 & " _ " & character id 92 & " " & character id 92 & " " & character id 92 & "
/"
& character id 92 & " / / | | " & character id 92 & "| | | | | " & character id 92 & " " & character id 92 & " / _ " & character id 92 & "
/ "
& character id 92 & " / / | | | | | | " & character id 92 & " " & character id 92 & " / / " & character id 92 & " " & character id 92 & "
/____/ /_"
& character id 92 & " | |_____/| | | | | | | / /___" & character id 92 & " " & character id 92 & "
/ / | _____ | | | | | | | | ___ |
/ / | | "
& character id 92 & "| | | | | | | | / " & character id 92 & " |
/ / _ | | | | | | / / | | | |
/ / /| | |_____/| | |_____/| | |_/ / | | | |
/ /________/ |/_________|/_________|/_____/ /___"
& character id 92 & " /___" & character id 92 & "
/ |
/________________|
                    "
buttons {"Play", "Quit"} default button 1

if the button returned of the result is "Play" then
   
   
end if

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 18 avril 2019  15:07:15

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)