简体   繁体   中英

How to run AppleScript from Windows program running in Mac Crossover?

I work on a program designed in C++ to run on windows, but the program is being used by some of our clients running Macs by installing it with crossovers. It works fine for the most part but our email generating has a problem. I wrote code to generate an applescript that will create an email for the mac but I am having issues executing it.

Things I've tried:

1) The answer to this question: How can I execute a simple Applescript from a C++ program? The system command never seems to execute.

2) I created a .app using applescript that when run, it executes my mail generating applescript. I tried running the script and the .app with ShellExecute() but it will just open the script or .app in the AppleScript Editor and WINE explorer respectively.

I'm assuming the windows environment that Crossover is creating in its "Bottle" is preventing me from running the scripts or .app. Is there anyway to get around this and accomplish running the script or .app?

The only solution I found to work was creating the helper .app that runs the AppleScript to generate mail, then calling ShellExecute() on the applet inside of the .app instead of the .app itself.

The code looks like this:

ShellExecute(NULL,"open","<PATH TO .APP>/Contents/MacOS/applet",NULL,NULL,0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM