AppleScript & Multiple Platforms

Ok, I have a program that I want to compile for both Windows and OS X. The OS X version will use an Apple Script, which I have added with no problems. The issue is when I want to compile for Windows, I get “This item does not exist”, which is of course true; however, I have the program setup so that it will only call the script from a Mac and not a Windows system, I would like to be able to compile this without having to modify the code each time I want a windows version.

In case it matters, the Applescript simply does a Reply To All on the currently selected messages in mail and then pastes the contents of the clipboard into the message. If there is another way to accomplish this without using AppleScript, I am open to this as well.

I also do not care about being able to put this in the Mac App Store, this is being used for developing an in-house tool.

I don’t recall the last time I tried to incorporate an AppleScript into an app, so I can’t help you there. However, if you have the MBS plugins, you can create and compile your AppleScript on the fly, which is awesome for flexibility. Windows compiles won’t complain about that.

Unfortunately, I can’t get the approval for purchasing plug-ins right now, not to mention there must be a way to do this without plug-ins.

use the TARGET function to “hide” the code from a WIndows Compile

#If TargetMacOS Then
     put your OSX specific code here

I just threw an AppleScript into a test project and was able to compile without issue. I thought you had already done as Dave suggested, but perhaps not?

I did, but I will take another look.

Ok, I see what I did wrong, I didn’t have the # before the if and endif statements. Thank you guys, very helpful.