AppleScirpt's days numbered.
On Saturday, April 4, 2015 at 12:02:06 AM UTC-4, Christopher Stone wrote: > > On Apr 02, 2015, at 19:15, Amandeep Jawa <[email protected] <javascript:>> > wrote: > > This new arrangement gives me less screen real estate on each file because > of the staggering. > > ______________________________________________________________________ > > Hey There, > > BBEdit is not good about placing windows exactly where you want them. > > But. It provides a mechanism whereby you *can* precisely move them > wherever you want on demand. > > I have 3 primary window-placement scripts. > > > ------------------------------------------------------------------------------------------- > > Zoom to screen > > > ------------------------------------------------------------------------------------------ > # Auth: Christopher Stone <[email protected] <javascript:>> > # dCre: 2010/10/15 23:47 > # dMod: 2010/11/04 13:10 > # Appl: BBEdit > # Task: Zoom front window to screen. (Not for multi-monitor set-ups.) > # Libs: None > # Osax: None > # Tags: @Applescript, @BBEdit, @Zoom, @Window, @Screen > > ------------------------------------------------------------------------------------------ > > try > tell *application* "Finder" > set deskBounds to bounds of *window* of desktop > end tell > > > set *item* 2 of deskBounds to 44 > > > tell *application* "BBEdit" > tell front *window* > set bounds to deskBounds > end tell > end tell > > > on error e number n > set e to e & return & return & "Num: " & n > tell me to set dDlg to *display dialog* e with title "ERROR!" buttons { > "Cancel", "Copy", "OK"} default button "OK" > if button returned of dDlg = "Copy" then *set the clipboard to* e > end try > > > ------------------------------------------------------------------------------------------ > > Standard resize with parameters for specific types of documents. > > > ------------------------------------------------------------------------------------------- > # Auth: Christopher Stone <[email protected] <javascript:>> > # dCre: 2011/09/21 18:14 > # dMod: 2014/04/07 01:41 > # Appl: BBEdit > # Task: Set bounds of front window to standard size. > # Libs: None > # Osax: None > # Tags: @Applescript, @BBEdit, @Resize, @Front, @Window > > ------------------------------------------------------------------------------------------ > > try > > > set appFldr to *path to* applications folder as *text* > set downloadModuleFldr to ((*path to* application support from user > domain as *text*) & "Script_Support:Downloader_Modules:") > set softwareRegFldr to ((*path to* documents folder as *text*) & "Software > Registration:") > > > tell *application* "BBEdit" > set frontDocPath to front *document's* *file* as *text* > > > # App-version-file: > if frontDocPath starts with appFldr and (name of front *document*) starts > with space then > set bounds of front *window* to {390, 44, 1329, 1200} > > > # Download Module > else if frontDocPath starts with downloadModuleFldr then > set bounds of front *window* to {390, 44, 1329, 1200} > > > else if frontDocPath starts with softwareRegFldr then > set bounds of front *window* to {407, 44, 1312, 1196} > > > else > set bounds of front *window* to {303, 44, 1617, 1196} > end if > end tell > > > on error e number n > set e to e & return & return & "Num: " & n > if n ≠ -128 then > try > tell current application to button returned of ¬ > (*display dialog* e with title "ERROR!" buttons {"Copy Error > Message", "Cancel", "OK"} ¬ > default button "OK" giving up after 30) > if ddButton = "Copy" then *set the clipboard to* e > end try > end if > end try > > > ------------------------------------------------------------------------------------------ > > All untitled windows to front > > > ------------------------------------------------------------------------------------------- > # Auth: Christopher Stone <[email protected] <javascript:>> > # dCre: 2010/11/13 12:31 > # dMod: 2015/04/03 22:35 > # Appl: BBEdit > # Task: Bring all 'untitled' windows to the front. > # Libs: None > # Osax: None > # Tags: @Applescript, @BBEdit, @Untitled, @Windows, @Front > > ------------------------------------------------------------------------------------------- > > try > > > tell *application* "BBEdit" > try > set index of (*windows* whose name contains "untitled") to 1 > on error > *beep* > end try > end tell > > > on error e number n > set e to e & return & return & "Num: " & n > if n ≠ -128 then > try > tell current application to button returned of ¬ > (*display dialog* e with title "ERROR!" buttons {"Copy Error > Message", "Cancel", "OK"} ¬ > default button "OK" giving up after 30) > if ddButton = "Copy" then *set the clipboard to* e > end try > end if > end try > > > ------------------------------------------------------------------------------------------- > > Now let's move on to your specific issue. This script will resize all > diff-windows to a specific size and position. > > Note that I have no error-checking in this script and leave that as an > exercise for the reader. > > > ------------------------------------------------------------------------------------------- > > tell *application* "BBEdit" > tell (*windows* whose name starts with "Differences") > set bounds to {301, 72, 1618, 1167} > end tell > end tell > > > ------------------------------------------------------------------------------------------- > > So. As you can see many things are possible. > > Multi-screen setups can be supported, but that's a little more complicated. > > -- > Best Regards, > Chris > > -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
