peval Posted February 20, 2021 Share Posted February 20, 2021 I am a basic user with just good copy-paste skills, and after days of googling, i could somehow put together a couple dozens of applescripts like the following two: tell application "Finder" set theSelection to selection repeat with thisFile in theSelection set theName to name of thisFile set name of thisFile to "Test - " & theName end repeat move selection to folder ((path to home folder as string) & "kDrive:TEST 2021:DESTINATION FOLDER") end tell The above script prepend a given text ("test" in the example) to the selected files in Finder, then move all of them to a given folder on my Mac The below script mount locally a folder sitting on my NAS, if it's not already open, then move the selected files from the finder to the NAS folder, and finally delete them locally on my Mac: tell application "Finder" tell application "System Events" to set diskNames to name of every disk if "video" is in diskNames then else mount volume "smb://mynas/video/" as user name "username" with password "password" end if move selection to folder ("video:MUSIC CLIP") delete end tell Right now i am launching such scripts using free software Apptivate (http://www.apptivateapp.com) which is super simple, i only have to set a keystroke and sub strokes, and everything works See an example, i just select multiple files in Finder and i type SHIFT+ALT+N and it opens up the sub-selection of scripts activated from letter N: I now have to just type V to narrow down to the sub-selection of scripts activated from letter V And now i just have to type M or W according to my choice, and the job is done. All letters are speaking, they are the initials of folders which are meaningful to me, so i always know by heart which keys to type Is it possible to do it with Alfred with the same simplicity? just typing my letters? If so I could just use Alfred instead of Apptivate and above all I assume the scripts would work with any other MacOS file manager, like Pathfinder for instance, which is currently not affected from my scripts above Many thanks!! Peval Link to comment
deanishe Posted February 20, 2021 Share Posted February 20, 2021 59 minutes ago, peval said: Is it possible to do it with Alfred with the same simplicity? just typing my letters? Yeah. Alfred is designed to work just by typing letters. I couldn't say if you'll be able to type the same ones as in Apptivate: I don't fully understand your description of how it works. 1 hour ago, peval said: I assume the scripts would work with any other MacOS file manager, like Pathfinder for instance, which is currently not affected from my scripts above Alfred can provide your scripts with the currently selected files in almost any application, but you would need to rewrite the scripts to accept the list of selected files from Alfred. Obviously, if your scripts explicitly ask Finder for its current selection—like yours currently do—they won't work with any other application. Link to comment
peval Posted February 20, 2021 Author Share Posted February 20, 2021 Thank you Deanishe for coming back! About your first comment. Apptivate works in this way: say that i have dozen of scripts, and 4 of them are related to my NAS, so i assign the same keystroke OPT+SHIFT+N to these four scripts since the letter N reminds me of NAS However if i type such keystroke, Apptivate does not know which script to launch out of the four, so i can assign a second key to be pressed to select which one Say that 2 of those scripts are referring to the folder VIDEO on my Nas, then i can assign the second key V to both of them Finally i need a third key to distinguish between them two, and i can choose W for one script and say Z for the other one This is the sequence of keys selected: This means that if i type OPT+SHIFT+N i am selecting all scripts pointing to the Nas, then i type V to select all scripts pointing to folder Video, then i select W because the subfolder is called Web Video and so on It is very simple and since the folders names do not change, i know by heart what to type About your second comment I am not an Applescript expert and i am happy to move away from them I thought that Alfred workflow could allow me to graphically build something similar to what the script does, without any scripting behing Am i wrong? are the workflow tiles just placeholder for actions that need to be coded? Many thanks! Peval Link to comment
dfay Posted February 20, 2021 Share Posted February 20, 2021 Alfred's search interface is designed to not act until you hit return - you can get finer grained results through filters but you'll need to hit return to trigger an action at the end. I requested something similar but no interest apparently. Link to comment
deanishe Posted February 21, 2021 Share Posted February 21, 2021 2 hours ago, peval said: Apptivate works in this way Okay. Alfred doesn't work that way (natively—it can be done). How you would do this in an Alfred workflow is (1) Hit your Hotkey for "currently selected files", (2) Search for the script to run by entering a search query in Alfred's search box, and (3) Hit ↩ to run the selected script. That's the standard way, and you could build that via drag-and-drop with, maybe, one line of code for step (3). Alfred's search is a "normal" text search, so if you want to find something called "Web video", you'll need to start typing either "web" or "video". But you could add "nvw" to the script's Spotlight comments and configure Alfred to search the comments, too. Or you can make Alfred's search work exactly how you want by writing a Script Filter. 2 hours ago, peval said: I thought that Alfred workflow could allow me to graphically build something similar to what the script does, without any scripting behing Am i wrong? are the workflow tiles just placeholder for actions that need to be coded? You can build fully-functional workflows without writing a line of code, but Alfred's primarily a launcher, not a development environment. It doesn't try to provide a comprehensive suite of built-in functions. It gives you some common, useful functions and makes it very easy to add a few lines of your own code to do exactly what you want. Based on the examples you’ve given, Alfred can take care of getting the selected files and choosing which script to run, but you will still need your AppleScripts (or some kind of scripts—you can use any language in Alfred) to move the files or mount a volume. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now