Closed bluepi0j closed 9 years ago
Could you post what the about of running osascript -e '1+1'
in Terminal outputs?
2015-01-21 01:34:03.974 osascript[2519:383540] Error loading /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find: /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: mach-o, but wrong architecture osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/QXPScriptingAdditions.osax" declares no loadable handlers. 2
Try deleting /Library/ScriptingAdditions/QXPScriptingAdditions.osax
apparently it doesn't support intel architectures.
It still doesn't work, but thank you so much
Which version of OS X are you using? Which version of play song?
For OS X, it's Yosemite 10.10.2 beta. For play song, it's v3.0.1
And this is the error report in Alfred, after I delete the QXPScriptingAdditions.osax
[ERROR: alfred.workflow.action.script] Code 1: execution error: System Events got an error: Can’t get menu bar item "Controls" of menu bar 1 of process "iTunes". (-1728)
Ah, I think you might have an old version of iTunes. What's your iTunes version?
If not, maybe you're using another system language than English, that is causing the problem.
I use chinese version of system,I think it should be the reason,thank you.
Could you try changing your system language to English and see if it them works?
If it does we'll have to make a fix for non-English system languages.
it works in English system
Ok try using this workflow and see if it works (with Chinese as your system language): https://github.com/Tyilo/play-song/raw/feature/l10n/Play%20Song.alfredworkflow
Also, try using the below version of the workflow (which still applies @Tyilo's fix, but is slightly reorganized): https://github.com/caleb531/play-song/raw/feature/l10n/Play%20Song.alfredworkflow
Caleb
Both of these two doesn't work(https://github.com/Tyilo/play-song/raw/feature/l10n/Play%20Song.alfredworkflow, https://github.com/caleb531/play-song/raw/feature/l10n/Play%20Song.alfredworkflow)
[ERROR: alfred.workflow.action.script] Code 1: execution error: System Events got an error: Can’t get menu bar item "Controls" of menu bar 1 of process "iTunes". (-1728)
I don't think localized string of
actually works in this case.
I think we will have to abandon the use of strings to refer to menu bar items and use an index instead. This is probably a bad solution, but I don't know of any other way to fix this.
@Tyilo: Perhaps we can wrap the existing function contents (with string names) in a try
block, and then on error
, we would run the code for selecting the menu item by indices. This way, at least, the function should be guaranteed to run correctly for English systems.
Hmm, I think it would be better to just only use indices. The code already mixes them (1
instead of "Off"
).
I've actually fixed this on my branch (feature/l10n
) to use strings exclusively. I'm honestly not sure why they were mixed in the first place—they really shouldn't be.
-- disables shuffle mode for songs
on disableShuffle()
tell application "System Events"
tell menu bar 1 of process "iTunes"
tell menu 1 of menu bar item "Controls"
tell menu 1 of menu item "Shuffle"
click menu item "Off"
click menu item "Songs"
end tell
end tell
end tell
end tell
end disableShuffle
Guess we have a solution: http://stackoverflow.com/questions/28132657/localized-menu-bar-item-strings-in-itunes/28156149#28156149
I have tested it and it works for me with a non-English language.
Fantastic—absolutely fantastic.
I've implemented the fix on my feature/l10n
branch. @Tyilo and @plkiplk, please test and confirm that this works so I can merge in this fix.
Thanks, Caleb
Works for me
does't work for me same problem
The localized string should be ve0frz64yk
instead of the one used right now.
However it only seems to work in Script Editor, not inside Alfred.
Maybe because Alfred isn't localized?
Test code:
-- disables shuffle mode for songs
on disableShuffle()
set iTunesPath to "/Applications/iTunes.app" as POSIX file as alias
set controls to localized string "8d2vvyy7c7" in bundle iTunesPath
set shuffle to localized string "atmqaez8y8" in bundle iTunesPath
set off to localized string "ve0frz64yk" in bundle iTunesPath
tell application "System Events"
tell menu bar 1 of process "iTunes"
tell menu 1 of menu bar item controls
tell menu 1 of menu item shuffle
click menu item off
end tell
end tell
end tell
end tell
end disableShuffle
disableShuffle()
Strange, though in my defense, I used the same localized strings provided by the designated StackOverflow answer (which includes a6vt8uhdqz
, not ve0frz64yk
).
I suppose that the lazy solution to this issue would be to simply wrap the function contents in a try
block. It would not guarantee that shuffle is disabled, but it would not prevent the script filter from continuing, either. Moreover, we can still recommend non-English users to disable shuffle manually to ensure correct play order for Play Song.
I guess that would be the best option.
Fixed in the latest commit. Will push a new release (v3.0.3) now.
Starting debug for 'Play Song'
[ERROR: alfred.workflow.input.scriptfilter] Code 0: 2015-01-21 01:09:33.613 osascript[2332:345183] Error loading /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find: /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: mach-o, but wrong architecture osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/QXPScriptingAdditions.osax" declares no loadable handlers. [ERROR: alfred.workflow.input.scriptfilter] Code 0: 2015-01-21 01:09:34.348 osascript[2339:345206] Error loading /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find: /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: mach-o, but wrong architecture osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/QXPScriptingAdditions.osax" declares no loadable handlers. [ERROR: alfred.workflow.input.scriptfilter] Code 0: 2015-01-21 01:09:38.992 osascript[2360:345334] Error loading /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find: /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: mach-o, but wrong architecture osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/QXPScriptingAdditions.osax" declares no loadable handlers. [ERROR: alfred.workflow.action.script] Code 1: 2015-01-21 01:09:41.505 osascript[2367:345357] Error loading /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find: /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: mach-o, but wrong architecture osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/QXPScriptingAdditions.osax" declares no loadable handlers. execution error: System Events got an error: Can’t get menu bar item "Controls" of menu bar 1 of process "iTunes". (-1728)