DEV Community


Discussion on: Automating a Mac using AppleScript

lberge17 profile image
Laura Berge Author

I'm glad you enjoyed reading! I think I'd have to see your code to understand the problem better. However, from videos and tutorials I've watched, it seems AppleScript is sometimes harder to predict what the outcome actually will be which makes debugging interesting. I know a lot of code requires added delays in order for the program to execute all the commands in the sequence we expect.

rikeshmm profile image
Rikesh Makwana • Edited

Using delay did fix the problem, I couldn't figure what the issue was all this while without this post! 😂😁
Here is the working code snippet!

tell application "Spotify"
    set track1 to name of current track
    next track
    delay 0.5
    set track2 to name of current track
    get track1 & track2
end tell
Thread Thread
lberge17 profile image
Laura Berge Author

Awesome! I'm glad delay fixed it.