Thursday, July 19, 2018

#1 2014-07-16 11:59:08 am

From:: South Tirol
Registered: 2008-07-04
Posts: 556

Better Label tool


i want to donate an older app i wrote at some time in the past. But i use it yet today, because its less intrusive unlike Apple's finder label feature used from Lion up.
The tool i present you, is a color label tool, to label your important files; and i know how it is to repeat over again right-clicks to label items. Annoying, especially for those who have bought costly older software who doesnt work on newer Mac Os builds, because Rosetta isnt supported anymore. So now you have a chance to label your files also on older systems with ease! For further info, "Usage" is written in the Help-section of the comments at the beginning of the script itself.

You have a selection of 7 spectacular colors to choose from!! lol

Instructions to build this app

1)    Save the below script as Application with name "Labels -en" or another meaningful name, on the Desktop
2)    Right-click on it. Navigate inside to: Contents:Resources:
3)    Here (inside folder Resources) create a new Folder and name it:        Labels
4)    Put 8 images with the suffix "icns" into the folder created in step 3. (Labels)
i suggest you to use 500x250 pixel sized icns and assign to them names in numerical order following this sequence:
0.icns == white, 1.icns == orange, 2.icns == red, 3.icns == yellow, 4.icns == blue, 5.icns == violet, 6.icns == green, 7.icns == grey


#Labels -en
#a) Drag "" into Finder's window toolbar
#b) Drag files onto "" to change the color of the label
#c) select files and click "" to highlight your files with the current (visible) label color
#1= org, 2= rot, 3= gelb, 4= Blau, 5= vio, 6= gruen, 7= grau
#Original Code Developed by Joy, 07.08.12
# this is -free software- use at your own Risk
# Visit me on: [url][/url]

property lb_id : {0, 1, 2, 3, 4, 5, 6, 7}
property all_lbs : {"NULL", "ORANGE", "RED", "YELLOW", "BLUE", "VIOLET", "GREEN", "GREY"}

on run
   set psx to ((path to me as text) & "Contents:Resources:" as text)
   set get_code to my find_cu_lb(psx & "Labels:")
   --set current label    
   tell application "Finder"
       set sel to the selection
       repeat with a in sel
               set label index of a to get_code
           on error
               set label index of a to 0
           end try
       end repeat
   end tell
end run

on open
   activate me
   set ch to choose from list all_lbs with prompt "Choose a label..."
   if ch is false then return
   set ch to ch as text
   --label code to assign
   set dd to 0
   repeat with a in all_lbs
       set dd to dd + 1
       if ch is in a then
           set get_code to item dd of lb_id
           exit repeat
       end if
   end repeat
   set psx to ((path to me as text) & "Contents:Resources:" as text)
   set change_icon to my find_cu_lb(psx & "Labels:")
   --send icon back into stock
   set retr_lab to (psx & "Labels:" & change_icon & ".icns" as text)
   set cmd to "mv '" & POSIX path of (psx & "droplet.icns" as text) & "' '" & POSIX path of retr_lab & "'"
   do shell script cmd
   --change droplet icon
   set retr_lab to (psx & "Labels:" & get_code & ".icns" as text)
   set cmd2 to "mv '" & POSIX path of retr_lab & "' '" & POSIX path of (psx & "droplet.icns" as text) & "'"
   do shell script cmd2
   tell application "Finder"
       --update apps label state
       update (path to me)
       --alias psx
       set sel to the selection
       repeat with a in sel
           set the label index of a to get_code
       end repeat
   end tell
end open

on find_cu_lb(psx)
   --find missing code
   set lf to list folder psx without invisibles
   set dd to 0
   --rewrite natural order
   if "0.icns" is in lf then
       set cc to -1
       set cc to 0
   end if
   repeat with a from 1 to 7
       set ch1 to character 1 of (get item a of lf)
       set find_cd to a + cc
       set ch1 to ch1 as number
       if find_cd = 1 and ch1 is 1 and a is 1 then
           set change_icon to 0
           exit repeat
       else if find_cd ≠ ch1 then
           set change_icon to find_cd
           exit repeat
       else if find_cd = 7 and ch1 is 7 then
           set change_icon to 0
       else if find_cd is 6 and ch1 is 6 then
           set change_icon to 7
       end if
   end repeat
   return change_icon
end find_cu_lb

Last edited by Joy (2014-07-17 05:40:57 am)



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)