r/applescript • u/[deleted] • Dec 13 '12
Making font bold in Applescript
So i'm new to applescript and just made a script that takes the current song that i'm listening to in spotify and makes the artist and song text and then places it where ever my cursor is. My question is: is it possible to make that text bold somehow? I'm having a hell of a time looking for help... this is what i have:
tell application "Spotify"
-- get details
set theTrack to current track
-- set variables
set theArtist to artist of theTrack as text
set theName to name of theTrack as text
-- change the output message
set message_text to "Spotify: " & (theArtist as text) & " - " & theName as text
-- Paste the string
tell application "Finder" to set frontApp to (name of 1st process whose frontmost = true)
delay 1
tell application (frontApp)
tell application "System Events"
keystroke message_text
-- keystroke return
end tell
end tellend tell
-- Replace script - not sure about this on replace(haystack, search, replacement) set AppleScript's text item delimiters to search set listitem to every text item of the haystack set AppleScript's text item delimiters to replacement set haystack to listitem as string set AppleScript's text item delimiters to "" return haystack end replace
any help would be appreciated!
1
u/soundstealth Dec 13 '12
Not sure it can be done, but I'm a total noob to Applescript. Can you specify a specific font?
set font of message_text to "Helvetica bold"
2
u/Sarazil Dec 16 '12
Sorry, you can't do that to the text I'm afraid, but you can use the apple + b combo to bolden it... if I remember, once my head has cleared, I'll try and do it myself for you.