samlimster Posted September 12, 2017 Share Posted September 12, 2017 Hi folks. I'm totally new to scripting and was trying to create a script that turns on Do Not Disturb for a set number of seconds and then turns it off. The number of seconds would be passed in as an Alfred argument. I have the script mostly done and working, but the last part is figuring out how to pass in the argument. Can someone please help me? Here's what I have so far: on run argv delay 3 tell application "System Events" option key down delay 0.1 tell application process "SystemUIServer" try tell (every menu bar whose title of menu bar item 1 contains "Notification") click (1st menu bar item whose title contains "Notification") end tell end try end tell option key up end tell delay ****[the argument from Alfred]**** tell application "System Events" option key down delay 0.1 tell application process "SystemUIServer" try tell (every menu bar whose title of menu bar item 1 contains "Notification") click (1st menu bar item whose title contains "Notification") end tell end try end tell option key up end tell end run Any help would be greatly appreciated! Thank you! Link to comment
deanishe Posted September 12, 2017 Share Posted September 12, 2017 (edited) If you want help with a workflow, please upload the entire workflow somewhere and post a link to it. Unless the issue is super-obvious, we're not going to be able to figure it out without running the code, and it's unreasonable to expect us to try to recreate your workflow from a single script in order to help you. That said, you aren't actually reading anything from the input argv. Assuming you've done everything else right, you probably need something like set theDelay to item 1 of argv. Edited September 12, 2017 by deanishe Link to comment
samlimster Posted September 13, 2017 Author Share Posted September 13, 2017 Thanks, @deanishe, That's all I needed to know. This worked perfectly. 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