Boarder24 Posted February 27, 2013 Share Posted February 27, 2013 On a workflow I am in the process of perfecting I am having a problem with the Post Notification, it runs before the php script does, so there is no output {query}. I think there should be a way to have optional delay timers for every part of the workflow. Also, there should be a way to trigger parts of the workflow. Link to comment
Andrew Posted February 27, 2013 Share Posted February 27, 2013 On a workflow I am in the process of perfecting I am having a problem with the Post Notification, it runs before the php script does, so there is no output {query}. I think there should be a way to have optional delay timers for every part of the workflow. Also, there should be a way to trigger parts of the workflow. Here is a picture to help explain the triggers: (Will upload when on desktop) This shouldn't be done with delays... If you wire the output of the script to a notification, it is only run after the script completes and the notification is passed the return value from the script. Link to comment
Boarder24 Posted February 28, 2013 Author Share Posted February 28, 2013 This shouldn't be done with delays... If you wire the output of the script to a notification, it is only run after the script completes and the notification is passed the return value from the script. Here is the workflow: http://d.pr/f/ukBX You can run it, even if you don't have the VPN, but I just can't make it work. This is why I think there should be delays and triggers to allow more flexibility for workflows. Link to comment
jdfwarrior Posted February 28, 2013 Share Posted February 28, 2013 Here is the workflow: http://d.pr/f/ukBX You can run it, even if you don't have the VPN, but I just can't make it work. This is why I think there should be delays and triggers to allow more flexibility for workflows. Jacob, New to PHP? Ok so here's what I found. The workflow that you linked to works correctly, you just got a little confused in a few places. In the "Run Script" action where you are getting the IP address and trying to post the notification, if you look at the top of the window, there is an option to select the language of the script that you will be running. Yours was set to /bin/bash. That's bash scripting which is just scripting from the terminal. It appears that you tried to use the PHP sleep command in a bash script. Since the syntax you tried to use is from a different language, and the syntax was off, its failing to execute that part and just skipping straight to the notification. The proper was to pause/sleep in a bash script is just "sleep 5" where 5 can be changed to however many number of seconds it is that you wish to pause. So by changing the code to this: sleep 5 IP=$(curl --silent http://icanhazip.com) echo $IP | pbcopy echo $IP The sleep command works normally and doesn't display until 5 seconds later. Boarder24 1 Link to comment
Tyler Eich Posted February 28, 2013 Share Posted February 28, 2013 Here is the workflow: http://d.pr/f/ukBX You can run it, even if you don't have the VPN, but I just can't make it work. This is why I think there should be delays and triggers to allow more flexibility for workflows. Try this link: http://cl.ly/1S0z2i163O1c I moved the shell script into the NSAppleScript node and told it to return the IP address. I attached the NSAppleScript to a 'Copy to Clipboard' node and a 'Post Notification' node. Does this help? Boarder24 1 Link to comment
Boarder24 Posted February 28, 2013 Author Share Posted February 28, 2013 Thanks guys! I got it working, here is the updated workflow if anyone wants to use it, all you have to change "VpnOneClick- Usa Ip" in the applescript to whatever your VPN's name is. Edit: Updated the Read Me section to include instructions and credits. Here is the new link: http://d.pr/f/E3Yh Link to comment
Andrew Posted February 28, 2013 Share Posted February 28, 2013 Thanks guys! I got it working, here is the final workflow if anyone wants to use it, all you have to change "VpnOneClick- Usa Ip" in the applescript to whatever your VPN's name is. http://d.pr/f/LMeR You might want to take a look at Tyler's solution as this is a more robust solution without a 'guessed' delay, and more how workflows should be created. I'm moving this thread to the workflow help sub-forum Tyler Eich 1 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