Jump to content

Getting the actual workflow directory on a system


Recommended Posts

Howdy all, have a bit of a conundrum.

 

In one of the workflows I am developing, I have a script which needs to set an environment variable for OSX such as:

 

set osascript to "/Users/stuartryan/Dropbox/AlfredSync/Alfred.alfredpreferences/workflows/user.workflow.EE2025D2-9836-4EF1-995D-B91C6A8D3377/passwordInput.osascript"

 

However, in order to do this I need to be able to tell what the workflow directory is on each system. Is there any automated mechanism/variable to do this? (Using osascript).

 

Alternatively the only other workaround I can think of is to check if a data directory exists for the workflow, and if not create it and "cat" a file there. Ideally I would copy the file over but I need to know where to copy it from first.

 

Thank you all... this one is doing my head in so trying to find what the best supported solution is.

Cheers,
Stuart
 
Link to comment

 

When Alfred runs your workflow, it always does to from the workflow's own directory.

 
That is to say, from any running workflow, the user's workflow directory is ../.

 

This is true, except for when you run something in Bash I have found, hence I need to be more explicit.

Link to comment

This is true, except for when you run something in Bash I have found, hence I need to be more explicit.

 

I don't understand.

 

If you're not running your script from within Alfred, the Alfred environmental variables Vítor mentions above that are "exactly what [you] needed" won't be available…

Link to comment

I don't understand.

 

If you're not running your script from within Alfred, the Alfred environmental variables Vítor mentions above that are "exactly what [you] needed" won't be available…

They are if I pass them through to bash. So basically I use a system command (perl) to run a command with Bash, but using the Alfred variables I am able to pass the data through that I need to that system command.

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...