AppleScript ObjC Remote Apple Events fails with variable

Hi, I'm new to using AppleScript Objective C in Xcode, but happy with basic pure AppleScript... so this is probably something obvious, any help greatly appreciated!


I'm currently trying to write a simple GUI Applescript App in Xcode to send commands to a networked Mac.

I have the script working in Script Editor but it's not behaving as expected in Xcode.


The following works in both Script Editor and Xcode:


using terms from application "Spotify"
  try
  tell application "Spotify" of machine "eppc://user:password@host"
  playpause
  end tell
  on error errM number errN
  display dialog (errM & space & errN)
  end try
end using terms from


The below version works in Script Editor, but in Xcode returns the dialog 'Can’t find remote machine. -915'.

I need to use the variable / 'property' in order to take user input for the logon details.



set remMachine to "eppc://user:password@host"
using terms from application "Spotify"
  try
  tell application "Spotify" of machine remMachine
  playpause
  end tell
  on error errM number errN
  display dialog (errM & space & errN)
  end try
end using terms from



Any help greatly appreciated! Thanks!