Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fried Chicken

Suspended
Original poster
Jun 11, 2011
582
610
I just rewatched the Tiger release video.
There was a bit on Automator, something I know absolutely NOTHING about, but has persisted until today (is Applescript still used?)


I almost never seem to see Automator mentioned in online google searches for how to do something. Same with Applescript, but it's still around. What's it used for? Anyone ever use it?

P.S. to any apple employees/engineers looking for new stuff to deprecate from the OS. Please DON'T TAKE THIS POST AS AN EXCUSE TO NEUTER THE OS MORE!
 
Yes, there are folks using it! To get an idea of what you can do with Automator or AppleScript, here a good site of a former Apple employee: https://macosxautomation.com

Personally I do much appreciate that even non-programmers can build some kind of working apps and can play with basic programming logic.

E.g. in real life, it's nice to have droplets around for repeated tasks. Simply drag a file on it and instantly get the desired result, instead of manually doing the same operations over and over again. Most of the time I'm using AppleScript simply as a wrapper for some shell script to make running it more comfortable, especially for others.

It is said, that AppleScript won't get much attention from Apple anymore in recent days and that it will probably get dropped in favour of JavaScript in the future. JavaScript can already be used inside AppleScripts, too.

Automator goes one step ahead and is offering an easy Drag'n'Drop programming environment for a bunch of tasks, services or workflows. For more complex apps, Automator can incorporate AppleScript, too.

For more serious work, there is also a way to write AppleScript based apps in Xcode and not just in Script Editor. That's probably cool for developer novices to get into Mac programming with Objective C or nowadays with Swift.

I'm sure that if you're thinking a bit about tasks you're doing quite often, you may imagine how you could benefit of automating tasks. Once you start using it, it makes fun to see a tiny app working and tinkering around with code.
 
  • Like
Reactions: Snappers
Very well said, OrganicCPU. I've been a Mac user since 2006 and only started using Automator last year. Up until then, I never had a use for it, so I never took the time to learn about it. That is until I started getting geeky and discovered I could create tiny apps out of simple scripts and run those apps, or even better, schedule those apps to automatically run at certain times. That's as far as I needed to go with it, but I still use it every single day.
 
  • Like
Reactions: organicCPU
I still have that somewhere.....i tried back in 2009 but never got the grasp or importance of the application.
 
I would love a script that automatically places any .dll file I download onto my server via SSH. Is this possible?
 
I've used Automator very rarely, so much that I had to re-read the instructions every time (not all of them, just the instructions for the aim). I guess most users have never or very rarely used it, hence without learning it, but googling to find a single solution. It is a shame, it looks to be pretty interesting to automate functions for archivists, students, developers. But I guess that so many operations are automated nowadays (e.g. batch-renaming, opening and editing...) that many scarcely feel the need to learn such a time and patience-requiring app.
 
I would love a script that automatically places any .dll file I download onto my server via SSH. Is this possible?
I'm sure there are several ways to get this done. Although, IMO the task is quite complex for your first script.

To track down the necessary steps:
1.) Watch a source folder for changes
2.) If the added file has a file extension .dll, run step 3.)
3.) Open ssh session
4.) Copy the file from source folder to destination folder
5.) Close ssh session

It's probably easier to make a new 'Folder Action' in Automator and add a shell script than writing an AppleScript.

To give you a basic idea of how it works, create two folders like ~/Documents/TEST/Automator/SourceFolder and ~/Documents/TEST/Automator/DestinationFolder in your home folder.

- In Automator choose from menu > File > New -> select 'Folder Action'
- Set 'Folder Action receives files and folders added to' > Other... > ~/Documents/TEST/Automator/SourceFolder
- Drag'n'Drop from Actions > Library > Utilities > Run Shell Script
- Select 'as arguments' from 'Pass input' -> that will write a loop for you
- Exchange the line 'echo "$f"' with whatever you want to execute (steps 2 to 5)
- Choose from menu File > Save... and give it a name like 'FolderActionCopyFile' -> That saves the folder action to ~/Library/Workflows/Applications/Folder Actions/FolderActionCopyFile.workflow and configures the SourceFolder with that action. By selecting the SourceFolder and right click, you can choose 'Folder Action Setup...' from the context menu and see how your folder is configured or make some changes.

To give a simple working example that you can place inside the 'Run Shell Script' window:
Code:
for f in "$@"
do
     cp -np "$f" "$HOME/Documents/TEST/Automator/DestinationFolder/"
done
Every file you'd then place into the chosen SourceFolder will get copied to the chosen DestinationFolder.

AutomatorCopyFile.jpg


Now it's up to you, learning how to implement your exact needs.

E.g., there is the if-statement that you'll want to just process .dll files. Extracting file extensions is done with string manipulations. Then you need to solve the connection to the server. I don't recommend the use of plain text passwords. There are ways to authenticate without entering a password, but by generating and placing authentication keys. Finally, you'll need to decide whether you better use the command cp, mv or rsync (that features copying to remote shell connections as a one-liner) to get the file transfer done.

If you're struggling with the script, asking the folks here on MR at the Mac Programming forum is probably a good idea. Happy Learning Mac OS X Automation...
 
Last edited:
  • Like
Reactions: Fried Chicken
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.