need a little help with apple script...

sithious

no longer a member
i assume most of you have already noticed and/or downloaded the cool new 10.1 apple scripts from apple's site ...
my favourite is tandem ... the only problem i have is that tandem opens two finder windows docked to the left side of the screen, which is where i keep my dock ... so the dock covers part of the windows...
i'd like to rewrite the script to make the two windows dock to the right side of the screen ...
any hints?
thanks! :)
 

Darkshadow

wandering shadow
Heh, I can say I used to be a script wizard...but I kinda stopped 'scripting and only remember the basic stuff. Where's tandem at? I haven't downloaded any extra scripts. If I take a look at it, maybe some of it will come back to me - at least enough to do what you want (hopefully).
 

Red Phoenix

Registered
I'm hardly an AppleScript wizard, but here's what I did. I downloaded this script and put it in the tool bar, but it always quits on me and does nothing. This is odd, since I can run it through Script Editor.

Fixing the script as you want is really pretty simple. There are, in fact, a couple of things I'd change with it, but right now it's not possible using just AppleScript. Maybe tomorrow I might post something that'll require the OSX PowerAddOns Lite scripting addition (which you can get at www.versiontracker.com). But for now, here's what you want specifically. Things in boldface are what you should change, and within (* and *)'s is an explanation of what to change and why:

property monitor_width : 1024 (*Set this to your actual monitor resolution width. For me, this was 1280*)

property monitor_height : 1024 (*Again, set this to your actual monitor resolution height. For me, this was 1024*)

set the startup_disk to (path to startup disk)

tell application "Finder"

activate set visible of (every process whose visible is true and frontmost is false) to false

-- BOTTOM WINDOW set this_window to make new Finder window

set the target of this_window to the startup_disk

set the bounds of this_window to {0 (*This is the left-most position of the window. Since icons in the dock can be at most 128x128 I believe, and there's a little space left, I'd suggest setting this to 150*), (monitor_height * 0.66) div 1, monitor_width, monitor_height}

set the current view of this_window to column view -- TOP WINDOW

set this_window to make new Finder window

set the target of this_window to the startup_disk

set the bounds of this_window to {0 (*Set this to the same number you set the above one to*), (monitor_height * 0.33) div 1, monitor_width, (monitor_height * 0.66) div 1}

set the current view of this_window to column view

end tell


Hope this works. What I'd like to modify are these things:

*Automatically recognizing the placement of the dock.
*Automatically recognizing the size of the dock.
*Automatically recognizing the resolution of the monitor.

These features probably would have been in here, but for some reason, the dock isn't scriptable, and I can't find a dictionary for checking the monitor resolution.
 

sithious

no longer a member
thank you, thank you, thank you, red phoenix,
perfect!

strange that the script doesn't do anything for you though... it's extremely useful (when it works) for copying files etc...

:) :)

looking forward to your further modifications... :)
 

Red Phoenix

Registered
I wish I knew why. It may be because I saved it in /Library/Scripts/Toolbar Scripts/, but that doesn't sound like it should be a problem.
 

sithious

no longer a member
...shouldn't be a problem... it works for me even if i put it on the desktop or on my other partition, so the adress can't really be the reason ... strange... corrupt download maybe?
 

Red Phoenix

Registered
I've tried re-saving it, but that didn't work. My final solution was to just save it as a compiled script, and leave that in my scripts menu.
 

sithious

no longer a member
there does seem to be something or other amiss with these scripts: you're having trouble running them, i can run them, but strangely enough none of them have the icon they're supposed to have according to apple's page and the seybold demonstration... they just have the usual script icon ...oh well, i can live with that... they're running and i can do custom icons ... :)
extremely cool stuff anyway, so thanks again, apple...!
and thanks to you for helping me rescript... :)
 

Red Phoenix

Registered
A reboot could possibly fix it, but I'm not going to bother since my uptime's almost 12 days right now.

Anyway, the following attachment is a slightly updated script that requires the OSX PowerAddOns Lite scripting addition (which you can get at www.versiontracker.com). It checks the dock's orientation (including the top), the size of the dock, and if it is set to automatically hide, and then adjusts accordingly. I also have it not automatically hide applications, but this can be changed.

There is still one annoying little flaw with it, and that's that I don't know where the monitor resolution preferences are kept, and so I can't have it automatically check for it. So the script needs to be modified at the beginning for your personal resolution (it's set for 1280x1024). If anyone knows where this is kept, please tell me so I can fix that.
 

Attachments

sithious

no longer a member
... cool! thanks, red phoenix ... this is great... maybe you should apply for a job with apple ... :)

edit: just tried to d/l the script... all i get is "attachment.php" ... hmmm ... could you repost it?
 

acur128

Registered
One possibility with the scripts quitting is the Toast extension "ToastVideoCDSupport.component" (in /Library/Quicktime if you're running Toast) conflicts with AppleScript applets/droplets in OS X 10.1... If you have Toast installed, simply removing the file temporarily - no logout or restart needed - will allow scripts to run from the Finder.
 

sithious

no longer a member
thanks a ton, red phoenix, great work ... :) this is the way apple should have done the script in the first place ... :)
 

Red Phoenix

Registered
I checked, and that wasn't it (I don't actually have Toast, but stranger things have happened). Thanks, though.

Someone on OmniGroup's MacOS X Admin mailing list has posted about this same problem. If anything comes of it (that works), I'll post it in case anyone else has this problem, too.

One thing that has occurred to me is that I have OSX PowerAddOns Lite (which I actually use and hence would like to keep). I might try removing it and logging out and in to see what happens. It shouldn't be a problem, but then, I shouldn't be having a problem in the first place.
 

sithious

no longer a member
red phoenix, i don't think it's either toast or the power add-ons ... i have both and it's working for me ... so it should be something else ... hmmm... strange.
 

acur128

Registered
Hey again-
Another thing that's been going around is 10.1 scripts saved as Apps in Script Editor 1.7 (10.1) not running from the Finder - briefly showing in the Dock then disappearing & never launching; but they run fine in Script Editor & 10.0 scripts saved as Mac OS X Applets run fine from the Finder... haven't found any cause yet (luckily I haven't seen it :))
I think the monitor resolution can be pulled from the windowserver property list - although it doesn't appear to be available through defaults, something like this seems to work with OSX Power AddOns (may need to adjust the word 11 part (should be the horizontal resolution)):
Code:
set theRes to word 11 of (Shell "cat /Library/Preferences/com.apple.windowserver.plist | grep -A 1 Width") as integer
 

Red Phoenix

Registered
Thanks for the location and the grep -A parameter. That's a really useful thing that I've needed before. Guess I should read the manuals more...

Anyway, I've changed that (and maybe a little bit more). You can get it here.

Just out of curiosity, has anyone else noticed the Browse Images script? That's pretty cool.
 

Red Phoenix

Registered
Incidentally, I pulled out my Mac OS 10.0.0 CD and type in the Terminal

cd ~/Desktop/; gunzip -c /Volumes/Mac\ OS\ X\ Install\ CD/System/Installation/Packages/Essentials.pkg/Contents/Resources/Essentials.pax.gz | pax -r ./Applications/AppleScript/Script\ Editor.app

and got the Script Editor v1.6. When I recompile the AppleScript applets with that, I can run it in the Finder. Suddenly, these Toolbar scripts have become even more useful for me.
 
Top