netnothing Posted November 17, 2016 Share Posted November 17, 2016 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
vitor Posted November 17, 2016 Share Posted November 17, 2016 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. Link to comment
netnothing Posted November 17, 2016 Author Share Posted November 17, 2016 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
vitor Posted November 17, 2016 Share Posted November 17, 2016 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
deanishe Posted November 17, 2016 Share Posted November 17, 2016 You can also use a Run Script to spit out the right path. -f means "file exists". if [[ -f "/path/to/your/file/here" ]]; then echo "/path/to/your/file/here" elif [[ -f "/path/to/your/other/file/here" ]]; then echo "/path/to/your/other/file/here" fi Link to comment
netnothing Posted December 1, 2016 Author Share Posted December 1, 2016 Thanks everyone. Ended up creating aliases to the files in Dropbox on both machines. The aliases are in the same folder I have, within my home folder, on both machines.....so the workflow will work across both machines. -Kevin Link to comment
dfay Posted December 1, 2016 Share Posted December 1, 2016 (edited) 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 December 1, 2016 by dfay netnothing 1 Link to comment
netnothing Posted December 1, 2016 Author Share Posted December 1, 2016 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
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