Jump to content
Tacitus

First workflow

Recommended Posts

I'm new to Alfred and am just trying my first workflow.

 

Basically this is use key command 'dx' to open my DropBox folder.  The script is:

 

on alfred_script(q)
tell application "Finder"
    set myWindow to make Finder window to folder "Macintosh HD:Users:ME:Dropbox"
    set current view of myWindow to list view
    set the sort column of the list view options of myWindow to the name column
    activate
end tell
end alfred_script

 

If i run the compiled Apple script via Script editor it works fine but used with Alfred it produces the following:

 

Alfred.thumb.jpg.cb0626085a2443b22f01a6990229df81.jpg

 

 

Click on the window and the DropBox folder opens but not directly from the Alfred command. Where am I going wrong?

 

 

Share this post


Link to post

If you’re just trying to open the directory, that is way too much code. The same can be accomplished with just tell application "Finder" to open "Macintosh HD:Users:ME:Dropbox".

 

Better yet, use Alfred’s already present capabilities: connect your Keyword to a Launch Apps / Files and drag your Dropbox directory there, like this.

 

Also, when asking for help with your workflow, always post a link to it. Without looking at it in full, it’s hard to know where your problem lies. This is especially true when you’re a novice, and the error might not even be on your code, but an option you set or forgot to change in the workflow.

 

Finally, macOS has excellent native methods to take screenshots, there’s no need to photograph your screen.

Share this post


Link to post

Thanks for the reply.  Tried it with the abbreviated code which was fine, but I'm not sure how to use Applescript force the open DBox window to the front.  Might check later just for the info.

 

Having spent time faffing with the Applescript version I downloaded your Workflow modified to fit my naming and it works fine so thanks very much.  One question does this workflow always bring the selected window- this case DropBox - to the front?  Not seemed to be a problem so far.

 

Incidentally when I tried using commands for screen shots the Alfred window kept vanishing so I finished up using my camera.....   Just rechecked and i was using the wrong commands :)  Something else I've learned today.

 

Thanks again - no doubt I'll be back from time to time as I get to grips with Alfred.

Share this post


Link to post
48 minutes ago, Tacitus said:

I'm not sure how to use Applescript force the open DBox window to the front

tell application "Finder"
	activate
	open "Macintosh HD:Users:ME:Dropbox"
end tell

 

49 minutes ago, Tacitus said:

One question does this workflow always bring the selected window- this case DropBox - to the front?

 

It should, yes.

Share this post


Link to post

Been looking through the script commands and tried it slightly differently :

 

tell application "Finder"

    set myWindow to make Finder window to folder "Macintosh HD:Users:Chris:Dropbox"

    open folder "Macintosh HD:Users:Chris:Dropbox"

    activate myWindow

end tell

 

 

Yours is much simpler and neater though :)

 

Just one point.  After the trigger command the Alfred window still has the workflow appended underneath, similar to the screen shot in my original post.  Hitting 'enter'  brings up the DropBox window.  Is this the standard behaviour?  It looks as though it is but I want to be sure in case I'm missing something for future use.

 

Been using your workflow and so far it always does bring the window to the front once I've hit 'enter'.

 

Interesting stuff.  Thanks for the help.

 

 

Edited by Tacitus

Share this post


Link to post

Sorry to prolong this but having got the DropBox window to display I'm looking at what displays.  Basically I want the window to display files by date with the latest one at the top.  Not sure if this can be done with Alfred commands but if it is I've not managed to do it.  

 

I've tried searching thorough the forum for a basic workflow that will do this and which I can modify and build on.  

 

Can anyone point me to one?

Share this post


Link to post

Searching for workflows is the wrong approach. Now that you have some working AppleScript, search the web for the way to sort the directory using AppleScript, and adapt your code.

Share this post


Link to post
On 10/03/2017 at 6:16 PM, Tacitus said:

OK.  I thought there might be an adaptable workflow rather than go the AppleScript route.  

 

Any workflow that does something like this (talking to Mac apps) is almost certainly using AppleScript to do it…

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×