views:

22

answers:

2

Hello,

I am trying to attach a Image to Mail application using Applescript. But on 10.5 I am getting

NSAppleScriptErrorNumber = -1708 error. What is this error means?

Can anybody guide me with this?

Regards, Sowmya

A: 

I wrote an applescript that tells you what the error codes mean. Get it here. Look in post #9 for the most recent version I posted.

regulus6633
A: 

As Philip Regan says. More info needed.

But I suspect its your construction of the file paths. I have used NSAppleScript in the past to attach files to mail. If I remember right. My app gathered the files path as a Unix type path string. i.e /Users/UserName/Documents/myFile.ext.

And in the NSApplescript script string I use "POSIX file \"%@\") as alias"

NSString *scriptString= [NSString stringWithFormat:@"set theMailname to (POSIX file \"%@\") as alias\ntell application \"Mail\"\nset newMessage to make new outgoing message with properties{visible:true,subject:\"%@\", content:\"%@\"}\ntell newMessage\nset visible to false\n\nmake new to recipient at end of to recipients with properties {address:\"%@\"}\n  set theAddressFrom to \"%@\"\ntell content\nmake new attachment with properties {file name:theMailname} at after the last paragraph\nend tell\n save \nend tell\nend tell",fileStore,subject,body,theAddressTo,theAddressFrom];

fileStore being the unix type path of the file that is converted to an Alias.

markhunte