DJay Posted May 22, 2015 Share Posted May 22, 2015 Hi Guys, when I run a Script in Alfred Remote that controls a submenu item the script doesn't work because of a space in the Menu Item. Apple TV (Airplay) can't be selected. When I run the script in OS X Script-Editor, the script works like expected. Is this a Bug in Alfred? Any idea how to make a workaround? Thanks in advance. on alfred_script() activate application "Deezer" tell application "System Events" tell process "Deezer" click menu item "Apple TV (Airplay)" of menu 1 of menu item "Output-Geräte" of menu 1 of menu bar item "Controls" of menu bar 1 end tell end tell end alfred_script Link to comment
deanishe Posted May 31, 2015 Share Posted May 31, 2015 Have you tried a Run Script action instead of the Run NSAppleScript one? That's generally a better thing to do in most cases, imo, because it doesn't block Alfred (unlike Run NSAppleScript). Link to comment
DJay Posted May 31, 2015 Author Share Posted May 31, 2015 Thx deanishe... I'm not so familiar with this. But I tried osascript if this is what you suggest. But I have the same problem. i.e. Schlafzimmer (Airplay) works, Apple TV (Airplay) did not. Link to comment
deanishe Posted May 31, 2015 Share Posted May 31, 2015 I'm afraid I don't have any Airplay devices to try myself. Have you tried setting it to "Interne Lautsprecher"? That might tell us whether it's really the space in the name that's the problem. Link to comment
DJay Posted May 31, 2015 Author Share Posted May 31, 2015 With all other Airplay Devices the script works. Also with the "Interne Lautsprecher" but they are also called "Standard" in the Script. I changed it to "Interne Lautsprecher (Eingebaut)" and it still works. It's strange. Only the "Apple TV (Airplay)" is not responding and not switching to it. Link to comment
deanishe Posted May 31, 2015 Share Posted May 31, 2015 That is weird. Does "Apple TV (Airplay)" always work from Script Editor? There's one more thing I can think of. Could you save the script from Script Editor. Save two copies, the first as File Format: Script and the second as File Format: Text. I've no idea what the German equivalent is, but the file extensions should be .scpt and .applescript respectively. Then try running these from Terminal with osascript myscript.scpt and osascript myscript.applescript. My thinking is that AppleScripts behave differently depending on whether they're compiled (.scpt) or not (.applescript). Link to comment
DJay Posted May 31, 2015 Author Share Posted May 31, 2015 Really appreciate your support deanishe. Thanks. Good point with the Script-Editor.. It gives also an error back. Only with Apple TV activate application "Deezer" tell application "System Events" tell process "Deezer" click menu item "Apple TV (Airplay)" of menu 1 of menu item "Output-Geräte" of menu 1 of menu bar item "Controls" of menu bar 1 end tell end tell error "„System Events“ hat einen Fehler erhalten: „menu item \"Apple TV (Airplay)\" of menu 1 of menu item \"Output-Geräte\" of menu 1 of menu bar item \"Controls\" of menu bar 1 of process \"Deezer\"“ kann nicht gelesen werden." number -1728 from menu item "Apple TV (Airplay)" of menu 1 of menu item "Output-Geräte" of menu 1 of menu bar item "Controls" of menu bar 1 of process "Deezer" Doing as you recommend with the Terminal and .scpt and .applescript of course then I also get an error. Daniels-iMac:~ Daniel$ osascript /Users/Daniel/Desktop/myscript.scpt /Users/Daniel/Desktop/myscript.scpt: execution error: System Events got an error: Can’t get menu item "Apple TV (Airplay)" of menu 1 of menu item "Output-Geräte" of menu 1 of menu bar item "Controls" of menu bar 1 of process "Deezer". (-1728) Daniels-iMac:~ Daniel$ osascript /Users/Daniel/Desktop/myscripttxt.applescript /Users/Daniel/Desktop/myscripttxt.applescript:84:216: execution error: System Events got an error: Can’t get menu item "Apple TV (Airplay)" of menu 1 of menu item "Output-Geräte" of menu 1 of menu bar item "Controls" of menu bar 1 of process "Deezer". (-1728) So maybe something is wrong with the Deezer App? Strange. Link to comment
deanishe Posted May 31, 2015 Share Posted May 31, 2015 It's strange that all the other outputs work, though. There are a couple of things I can think of that might shed more light on it. This workflow allows you to search the active application's menus in Alfred. You could try that and see what it shows for "Airplay" or "Apple TV". Also, if you have Xcode installed, there's an app called Accessibility Inspector in it (/Applications/Xcode.app/Contents/Applications/Accessibility Inspector.app). Run that app, then hover over the "Apple TV (Airplay)" menu item in Deezer. Check what Accessibility Inspector shows. In particular, accessibilityTitle. It's possible that it's expecting a different name. If that doesn't provide any useful information, I'm afraid I'm all out of ideas… Link to comment
DJay Posted May 31, 2015 Author Share Posted May 31, 2015 Great tips.. but unfortunately again.. nothing that shows weird. However.. thanks a lot for your time and trying to help. Link to comment
deanishe Posted May 31, 2015 Share Posted May 31, 2015 Scheibenkleister Might be worth getting in touch with the people at Deezer. It doesn't appear to have anything to do with Alfred. 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