Jump to content

A question about "Does Path Exist” Automation Task [Solved]


Recommended Posts

In the context of this workflow I'm trying to trap any case where a user fails to set up the requisite temporary folder in advance of using the workflow (as well as improving the Readme to make it clear that is required). For that purpose I'm feeding into the Does This Path Exist Automation Task the Temp folder variable - which by default is ~/Downloads/Temp.

 

When I evaluate the output from that Automation Task using a Conditional the only way I can obtain a True result is if I input into the Automation Task the full path (i.e., /Users/[Username]/Downloads/Temp).

 

This Alfred help page states:

 

Quote

The File Picker configuration previews the home folder as ~, but the Workflow sees the real /Users/[username] path. Take advantage of this in the Default Value field: using ~ ensures the path is correctly expanded for your users.

That to me suggests that the input I originally used to the Does This Path Exist Automation Task should work.

 

It is of course entirely possible that I've misunderstood something fundamental but assistance would be much appreciated.

 

Stephen

Edited by Stephen_C
Link to comment

Sorry to respond to my own post but I have only partly solved the problem. If I precede the Does This Path Exist Automation Task with the Get Path Dirname Automation Task I can pass into the former Automation Task the full path—which then evaluates correctly under the Conditional...so long as the path exists. However, if the path does not exist the latter Automation Task throws an error (Get Path Dirname)which I need to trap somehow.

 

Quote

14:25:40.101] ERROR: Reduce size of JPEG/PNG file[Automation Task] Task Argument Error: Expecting single or multiple inputs. Warnings: (
    "Passed in file '/Users/[Username]/Downloads/Temp' does not exist, discarding"

 

Edit: And, of course, I have only just noticed Expand Tilde in Path: so sorry. That looks like a solution.

 

Stephen

Edited by Stephen_C
Link to comment
  • Stephen_C changed the title to A question about "Does Path Exist” Automation Task [Solved]

Instead of checking if the path exists and failing if it doesn’t (making the user manually create it), have you considered always creating the folder (there’s an Automation Task for that as well)? Do it in /tmp if you want it to be somewhere that gets auto-deleted on reboot. That’s the technique in TinyPNG.

Link to comment

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
×
×
  • Create New...