Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Dragthing, AppleScripts and hot keys Apps
Okay, here is a quick run-down of how I fully utilize the power of DragThing. DragThing is a MacOS utility that provides multiple tabbed docks to store aliases, web links, etc. It also has a process dock that acts much like the MacOS X dock (with some customization differences).

What really hooked me, though, was the ability to add hot-keys and applescripts.

Read the rest of this article for some useful examples of both hot keys and AppleScripts with Drag Thing, including a script to automatically display an updated listing of your volumes in a dock layer.

Let's start with something simple. You want to be able to assign a hot-key that will open a selected file in the Finder into a favorite application. For instance: Select one or more files in the Finder, then hit cmd-cntrl-b to open those files into BBEdit.

Create the following applescript (using ScriptEditor) and save it as a compiled script (not an application):
--OpenWithBBEdit.scpt 
--path to the BBEdit application
set BBEdit to "Sorenson:Applications:Office:BBEdit:BBEdit 6.5"
tell application "Finder"
open selection using BBEdit
end tell
I believe Apple has already given you a Scripts folder in your Library folder to save such things. Now drag that script to a slot in DragThing. I have a layer that is dedicated to holding hot-key scripts. Right-click on the script in DragThing and select "Item Options...". Click "Use Hot Key to open item" and click on the bar to assign it the cmd-cntrl-b combination.

That's it! From here on, you can select a file, and hit cmd-cntrl-b to open it in BBEdit. You can create other scripts for all your often-used apps.

Notice that you can also make a hot-key to bring the finder to the front with this script:
--ActivateFinder.scpt 
tell application "Finder"
activate
end tell
Now, let's say you want to make a DragThing layer hold all your volumes (including temporary volumes!). Create the following script, and give it a hotkey. Now, everytime you hit that hot-key, DragThing will appear, switch to the Disks layer, and update the slots with your mounted volumes. Slick, eh??
--DragThingDisks.scpt
--This script will bring Dragthing to the front, add/update a list of
--mounted volumes to the dock and layer specified onthe first two lines,
--and switch to that layer.
--
--The savedslots variable refers to to how many slots you want to be left
--alone. For instance, if you wish to keep your Home and Temporary
--directory in the top two slots, set savedslots to 2.
--
--Shortcomings: You'll notice that any network volumes that have the base
--directory mounted can not be perused. This is a limitation imposed by
--DragThing due to complications in MacOSX.

set diskdock to "Main"
set disklayer to "Files"
set savedslots to 2

--Get the list of mounted volumes from the Finder
tell application "Finder"
set disklist to the name of every disk as list
end tell

--Count the mounted volumes
set disknumber to number of items in disklist

tell application "DragThing"
activate
--switch to the disk layer
select layer disklayer of dock diskdock

--Count the number of slots available in the layer
set maxslots to the number of slots of layer disklayer of dock diskdock

--Make sure the number of volumes doesn't exceed the size of the layer
if disknumber > (maxslots - savedslots) then
set disknumber to (maxslots - savedslots)
end if

--Add each volume one at time
set n to 1
set m to 0
repeat until n > disknumber
if (item n of disklist as string) contains "Servers" then
--ignore and adjust marker
set m to 1
else
--add the volume
set file location of slot (n + savedslots) of layer disklayer of
dock diskdock to file (((item n of disklist) & ":") as string)
end if
set n to n + 1
end repeat

--clear any leftover volumes from the layer
set n to n + savedslots - m
repeat until n > maxslots
delete slot n of layer disklayer of dock diskdock
set n to n + 1
end repeat
end tell
DragThing can be found at dragthing.com. If you have questions or comments on these scripts, please post them here...
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[8,661 views]  

Dragthing, AppleScripts and hot keys | 4 comments | Create New Account
Click here to return to the 'Dragthing, AppleScripts and hot keys' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Hot Spots
Authored by: warrior on Nov 30, '01 06:51:03PM

Another great feature that's worth noting is that DragThing does hot spots really well. I have actually killed my dock and replaced it with DragThing. It's at the bottom of my screen and takes up only half the space of the dock. Set the hot spot to the bottom of the screen. Now when you open applications, instead of going behind the Dock, like they normally would, they go on top of DragThing, but when you move the mouse to the very bottom of the screen, DragThing jumps to front. All I need now is for DragThing to support the dynamic icons so I can see when I have new e-mail and I'll be set! Definitely worth every penny to get it.

-Shane



[ Reply to This | # ]
Change Dock Size?
Authored by: mpmchugh on Dec 01, '01 09:11:14PM

Is there any way to modify the script to dynamically increase or decrease the number of slots in the dock so there are never extraneous ones, or not enough?



[ Reply to This | # ]
Change Dock Size?
Authored by: james_sorenson on Dec 02, '01 01:42:43AM

Here, this will give you the current number of vertical and horizontal
slots in DragThing.

tell application "DragThing"
set vertslots to vertical slots of dock "Main"
set horizslots to vertical slots of dock "Main"
end tell



[ Reply to This | # ]
Disk Layer script now obsolete.
Authored by: james_sorenson on Apr 16, '02 12:03:07PM

There is a new version of DragThing (4.3) that now has a dynamically-updated "Disk Dock." This basically makes all my hard work on the Disk Script obsolete. <sniff>

Well, that's the breaks when you have an author who listens to his users. ;-)



[ Reply to This | # ]