Executing a Do File in Mac Stata SE 16.1 - stata

I have a .do file in Stata SE 16.1 on Mac OSX and I'm looking to execute it. I'm traditionally a Windows user, so am used to executing using control-D. When I attempt to do the same on the Mac OSX, a small Finder window pops up and forces me to choose which file I want to execute. Is there a way to get rid of this? I just want to be able to mouse-less way of executing the currently open .do file...

Shift-Command-D is the default Mac OS keystroke to execute the .do file in the currently active window. This will also execute selections, and is equivalent to Window Cntrl-D.
The comments above are all true as well.

Related

Launch command line programs behind all open windows from a C++ executable

I am working on C++ program in windows which launches numerous external programs using command lines in quick succession after previous one finishes. Currently a new terminal pops up in front every time I make an external program call. I have tried SYSTEM an POPEN. Is there a way to launch these terminals in the back behind all open windows so that its not annoying to the end user who may be working on other stuff?
One solution is listed here but doesn't work for me as it still pops up terminal in the foreground.
c++ run system() in background, with spaces in dir path, + output to text file
system("start \"\" cmd abcd.exe");
Unless you really need to use system(), I would recommend using ShellExecuteA, if you set nShowCmd to 0, it doesn't generate any windows or pop up any consoles.

Using spawn_posix to launch pkg (Writing Autoupdater for audio plugin)

I'm writing an auto-updater for my audio plugin which is working fine on Windows, and I feel I'm close on MAC but need some help understanding how to programmatically launch the installer on mac. The algorithm is pretty simple:
Plugin checks in S3 to see if there's a newer version
If YES then plugin downloads the installer for the new version
Once downloaded the plugin should launch the installer and prompt the user to close the DAW (audio workstation)
This is working fine, I can download the installer on both platforms, and on windows launch it by using CreateProcess, but I can't find the right way to do it on mac. The closest equivalent I can find is "posix_spawn" in order to launch a process and then run "/user/sbin/installer -pkg /path/to/pkg /target", and although this is returning 0 indicating success I don't see any installer popping up on the screen. Ideally the user would see the UI of the installer as there are some options included.
How can I accomplish the goal of opening a PKG file visually for the user on mac using C++? OR, is there an alternative solution to accomplish the algorithm described above? Many thanks!

How do I save a TextEdit (mac) file with a custom extension (.sas)?

So, I'm in the process of writing some code for SAS and I realized I have to save the file as filename.sas. My professor mentioned that I would have to use note pad or another text editor on my computer.
How can I use TextEdit on the Mac to save a .sas file? Opening TextEdit, adding some text, and saving causes the file to have a .rtf or .odt extension added to it.
Should probably add that my mac version is 10.5.8
Your Mac comes with TextEdit, which is a perfectly good basic text editor. Be sure to choose Format > Make Plain Text so that you get a text file. Be sure to uncheck Hide Extension when you save, and provide the .sas extension manually. Or you can change the extension later using File > Get Info in the Finder.
You also have pico, vim, vi, emacs, and probably a host of others in the Terminal.
Above mentioned solutions are best suitable for older mac os versions.
But for the latest mac os version(Mojave or later) try with nano or other command-line text editors.

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);

How to launch a mac application without a terminal window

I've written an open-source c++ application and it works fine on Windows and Linux, I finally got a Mac Mini (with 10.5.8) so I've just been testing the Mac version.
My application works fine when running it from inside a terminal window and typing ./appname , but if instead I double click on it from the finder, then it opens a termnial window first and then runs my app but it doesn't seem to set the working directory to the correct location so my app dies.
How do I make my app so when it launches by being double clicked on it doesn't open a terminal window first and how can I have the current directory set to the apps location automatically?
Mac binaries are set to be opened with the 'Terminal' program; there's no way around that, except by making a full application package, or have another program launch it via system or something like that.
When double-clicking on a binary, the terminal window opens with ~ as the current directory. I suggest you use chdir(2) in your program to ensure it is running in the right directory if you need it in the first place.