jodrell Posted October 25, 2013 Share Posted October 25, 2013 I've created a simple workflow using a script to switch the audio output on my Mac from Stereo to Mono or back. I'd like a notification to tell me what it's just done. I've got a keyword, a Run NSAppleScript and a Post Notification block The AppleScript is as follows, on alfred_script(q) tell application "System Preferences" reveal anchor "Hearing" of pane id "com.apple.preference.universalaccess" end tell tell application "System Events" tell application process "System Preferences" tell window "Accessibility" set monoStereoCheckbox to checkbox 2 of group 1 if (get value of monoStereoCheckbox) as boolean is true then set statusNow to xmlItem({title:“Stereo”}) else set statusNow to xmlItem({title:“Mono”}) end if tell monoStereoCheckbox to click end tell end tell end tell if application "System Preferences" is running then tell application "System Preferences" to quit end if return giveFeedback(statusNow) end alfred_script and the Post Notification has a Title and {query} in the text...I'm assuming I'm missing something simple and obvious but what? Link to comment
jdfwarrior Posted October 25, 2013 Share Posted October 25, 2013 I've created a simple workflow using a script to switch the audio output on my Mac from Stereo to Mono or back. I'd like a notification to tell me what it's just done. I've got a keyword, a Run NSAppleScript and a Post Notification block The AppleScript is as follows, on alfred_script(q) tell application "System Preferences" reveal anchor "Hearing" of pane id "com.apple.preference.universalaccess" end tell tell application "System Events" tell application process "System Preferences" tell window "Accessibility" set monoStereoCheckbox to checkbox 2 of group 1 if (get value of monoStereoCheckbox) as boolean is true then set statusNow to xmlItem({title:“Stereo”}) else set statusNow to xmlItem({title:“Mono”}) end if tell monoStereoCheckbox to click end tell end tell end tell if application "System Preferences" is running then tell application "System Preferences" to quit end if return giveFeedback(statusNow) end alfred_script and the Post Notification has a Title and {query} in the text...I'm assuming I'm missing something simple and obvious but what? Is "return giveFeedback(statusNow)" where you are trying to return the status back to a notification? If so, what is giveFeedback? Where is it defined? Also, I think I saw an article last night where you can easily create a notification directly from AppleScript here. Shouldn't need that though. Just shared for information purposes. Lets get it working from Alfred Link to comment
jodrell Posted October 30, 2013 Author Share Posted October 30, 2013 (edited) erm, giveFeedback probably isn't defined because i was looking at other scripts and trying things out to see what worked...in this case it didn't :-) I guess I just need to know what needs to be output from the script for it to be picked up in the {query} section of the notification box Edited October 30, 2013 by jodrell 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