Search the Community
Showing results for tags 'UI Scripting'.
A troubleshooting conversation in the "Mavericks Merge All Finder Windows" workflow thread recently pointed out that errors can easily arise with UI Scripting because the variable names change. For instance, the command in that workflow was click_menu('Finder','Window','Merge All Windows') where click_menu was a custom function to make UI scripting easier. But, some users were having problems because their operating system wasn't in English. Kopischke pointed out the fix: His solution for German was click_menu("Finder", "Fenster", "Alle Fenster zusammenführen") While I haven't seen this solution before, I'm pretty damn sure that it's been the source of problems for other workflows. So, I have some proposals as to how to fix it. The first is a stop-gap measure, and the second is a larger project. The stopgap measure would just be to drop in a few lines of code with a text file: set thelang_ to user locale of (get system info) if thelang_ is not "en_US" then tell application "TextEdit" activate open (((path to desktop) as text) & "non-en-instructions.txt") end tell end if Obviously, you'd want to store the "non-en-instructions.txt" file in the Workflow itself, so you'd probably want to play around with the path variable. Also, it would probably be good to set it to not en_US or en_UK (is it UK?). The contents of the text file could be as simple as: That's it. The more robust option would be to develop a translation library for UI scripting. One might already exist, but I haven't looked. Then, in the library, we'd have a file for each language that would have the translations from English (or from whatever language we want). So, German would have the entries Window: "Fenster" Merge All Windows: "Alle Fenster zusammenführen" along with many more. We could then set the variables with a quick function call after getting the user's language. I think that this could be a great project and one that would need to be undertaken collaboratively, but right now I don't have the time to tackle it. If anyone wants to start on it, then please do. When my schedule opens up, I'll start on it if no one else has already. Anyway, thoughts? --Shawn