Jump to content

Launch apps/file workflow paths on different machines


Recommended Posts

I have Alfred installed on my 2 machines.  I'm syncing prefs....so naturally workflows are synced.

 

I have a workflow that uses Launch apps/files to quickly launch KeePassX, opening a certain database file.  Now, the DB file it opens is stored in my Dropbox folder.  However, recently I changed the location of my Dropbox folder on my main machine.  I of course had to update my Workflow to point to the new file path, however, this is now breaking this workflow on my other machine since the Dropbox folder paths don't match.

 

Anyway to fix this?  I tried manually editing the workflow path, but it doesn't allow that.  Was going to put a symlink in my main machine homefolder to Dropbox to set the path back.....but the workflow only allows drag/drop of files.

 

-Kevin

Link to comment
1 hour ago, vitor said:

You can figure out something unique about each machine and have your workflow check for that when it starts. Then tell it to use the appropriate directory depending on which machine it determines to be running on.

 

Any idea what I use in the workflow to do this check?

Link to comment

Depends entirely on your coding ability and how the workflow is structured. system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' gets you the serial number of the machine, for example, so that’s a good unique indicator.


If you give me a link to your workflow, I can see how it is structured and try to change it.

Link to comment
  • 2 weeks later...

For future reference to anyone interested, here's how I solved this problem in AppleScript, in this case to run different Chronosync documents per machine.  (In addition, I have a post-run script set up in Chronosync that updates a file in Dropbox indicating which machine the sync last ran on, and a Script Filter in Alfred that displays this status as a subtitle - can post if anyone's interested).  

 

set theComp to computer name of (system info)
	tell application "ChronoSync"
		if theComp contains "MBA" then
			open "/Users/username/Documents/archive/MBA to MyUSBStick.sync"
		else if theComp contains "iMac - work" then
			open "/Users/username/Documents/ChronoSync Documents/MyUSBStick Documents <> iMac - work.sync"
		else if theComp contains "MBP" then
			open "/Users/username/Documents/archive/MBP to MyUSBStick.sync"
		else if theComp contains "Mac Mini" then
			open "/Users/username/Documents/ChronoSync Documents/Mac Mini to MyUSBStick.sync"
		end if
		Trial Sync document 1
	end tell

 

Edited by dfay
Link to comment
52 minutes ago, dfay said:

For future reference to anyone interested, here's how I solved this problem in AppleScript, in this case to run different Chronosync documents per machine.  (In addition, I have a post-run script set up in Chronosync that updates a file in Dropbox indicating which machine the sync last ran on, and a Script Filter in Alfred that displays this status as a subtitle - can post if anyone's interested).  

 


set theComp to computer name of (system info)
	tell application "ChronoSync"
		if theComp contains "MBA" then
			open "/Users/username/Documents/archive/MBA to MyUSBStick.sync"
		else if theComp contains "iMac - work" then
			open "/Users/username/Documents/ChronoSync Documents/MyUSBStick Documents <> iMac - work.sync"
		else if theComp contains "MBP" then
			open "/Users/username/Documents/archive/MBP to MyUSBStick.sync"
		else if theComp contains "Mac Mini" then
			open "/Users/username/Documents/ChronoSync Documents/Mac Mini to MyUSBStick.sync"
		end if
		Trial Sync document 1
	end tell

 

Thanks!  This worked out perfectly.....and much better than my hack ;-)

 

Only thing I changed was I added "activate" within the tell so that KeepassX's window would be brought to the front.

 

-Kevin

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