Wondering if there’s .bat file alternatives for Mac. I can easily make .bat files in Windows, by opening Notepad and saving as .bat, but when I try and make a .sh file in Mac using TextEdit, it doesn’t even seem to recognize it properly. The .bat files you can double click to run in Windows, but for Mac, using .sh just opens up TextEdit. Even if I manually select Terminal, it doesn’t seem to work. If .sh files do work for Mac, in that same manner where you just double click them, then I’m not sure what I’m doing wrong.
I never used a mac but maybe there’s a way you can make it executable using permissions? Like “chmod +x”
You are looking for AppleScript.
… or Python
… or any other scripting language (…Ruby is apparently still very much a thing for some reason).
What are you trying to do?
You need to set the file as executable
Same with java files
Right click more info brings up a tab with settings select executable
I don’t see what you’re talking about. When I right click I select “Get Info”, but there’s nothing there for setting it as an executable.
Ruby did nothing wrong! Most of the hate comes from Ruby On RAILS.
chmod +x was a thing on OS X several generations ago, i dont know if it still is. full on real crunch bang unix scripting is possible. as well as crontab.
One of the well regarded tools for automation is keyboard maestro:
Without using third party tools, AppleScript is the most useful if you grant your script accessibility permissions, that way you can click at x, y on a given monitor, send key strokes to standard in, and access the clipboard.
I have usually invoked AppleScript commands from within a shell script.
The most recent time I used AppleScript was to scrape a website protected by the duo two factor authentication system. I used a shell script to send commands to safari, then did select all, copy, then the shell command to send the results to a text file named based on the query string. The scrape was performed by an authored user against a system that did not disallow that behavior (as they thought it was impossible).
Managed to get them somewhat working, but I had to specifically exclude the .sh piece/part of the file name/type. So it was basically a file without any specification.
This was key, and helped out a lot. I had familiar experience using this on Linux, so things worked out a bit.
However, I still can’t get them to run normally just by double clicking them/the file/files.
In order to get them to run, (as expected), I have to open up an elevated Terminal window to do so.
If a regular/non-elevated Terminal window is used, I get an error message saying that it can’t find/load the compiled Java file/files.
Any ideas?
Edit- NVM I GOT IT!!!
Had to literally specify “cd”/change directory in the executable file in order for it to run.
Another Edit- Had to make the text file plain text in TextEdit, and get rid of the "If no extension is provided, use “.txt”. selection when saving. Even afterwards when the file wasn’t open anymore, it would NOT let me change the file extension, so I could properly have it set up as an executable.
SICK!
I can even load them from the dedicated Applications folder. I can even load them on startup too, like you can on Windows by going to: System Preferences > Users & Groups > Login Items (tab) > clicking the + button > selecting the executable run file, and then clicking the Add button
FINALLY
I’ve been waiting/wanting to do this/looking to do thid/wondering how to do this/wondering if this/was/ever has been possible to do this for so long