Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.5: Use AppleScript to better work with Spaces System 10.5
I found this post on another site that has some cool AppleScripts for working with Spaces via keyboard shortcuts. Specifically, the scripts allow:
  • Assign to All Spaces: assigns the frontmost window to all spaces.
  • Assign to Space X: opens an input dialog asking you which space to assign the frontmost window to.
  • Collect on Current Space: brings all windows from the frontmost application to the current space.
  • Remove Assignments: remove any application assignments the frontmost window may have.
[robg adds: I haven't tested these, and I borrowed the above descriptions of the scripts directly from the author's site.]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[8,474 views]  

10.5: Use AppleScript to better work with Spaces | 3 comments | Create New Account
Click here to return to the '10.5: Use AppleScript to better work with Spaces' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.5: Use AppleScript to better work with Spaces
Authored by: jonn8n on Wed, Dec 26 2007 at 10:26AM PST
I've posted a library of AppleScript routines for working with Spaces that may be of interest:

http://bbs.applescript.net/viewtopic.php?id=23453

Jon

[ Reply to This | # ]
10.5: Use AppleScript to better work with Spaces
Authored by: S Barman on Wed, Dec 26 2007 at 11:36AM PST
The various functions look interesting. However, I would change the last function to use "tr" instead of perl:

on make_lowercase(the_string)
   return do shell script "echo " & quoted form of the_string & " | /usr/bin/tr '[:upper:]' '[:lower:]'"
end make_lowercase
In the original script, you assume the character set locale to work with utf-8. Although utf-8 is more-or-less universal, it does have some problems with accented characters in non-English languages. The "tr" program respects current locale settings, which is more friendly to non-English character sets.

[ Reply to This | # ]
10.5: Use AppleScript to better work with Spaces
Authored by: jonn8n on Wed, Dec 26 2007 at 11:53AM PST
This is what I get in my testing:
{make_lowercase("JØnathan"), make_lowercase_alt("JØnathan")}
-->{"jønathan", "jØnathan"}

on make_lowercase(the_string)
	return do shell script "echo " & quoted form of the_string & " | /usr/bin/perl -pe 'use encoding utf8; s/(\\w)/\\L$1/gi'"
end make_lowercase


on make_lowercase_alt(the_string)
	return do shell script "echo " & quoted form of the_string & " | /usr/bin/tr '[:upper:]' '[:lower:]'"
end make_lowercase_alt

Jon

[ Reply to This | # ]