====== Differences ====== This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
script_launch_first_item [2014/03/12 00:42] tbog created |
script_launch_first_item [2014/03/12 00:53] (current) tbog [About the script] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== About the script ====== | ====== About the script ====== | ||
| - | * Purpose : Launch the first (the topmost leftmost item) from a folder. | + | * Purpose : Launch the first (the topmost leftmost item) from a folder without opening the folder. |
| * Author : TBog | * Author : TBog | ||
| * Link: www.google.com/+BogdanTautuTBog | * Link: www.google.com/+BogdanTautuTBog | ||
| Line 25: | Line 25: | ||
| var minItem; | var minItem; | ||
| var i = 0; | var i = 0; | ||
| + | /* make sure we find at least a shortcut */ | ||
| while ( i < count ) | while ( i < count ) | ||
| { | { | ||
| Line 40: | Line 41: | ||
| var minTop = minItem.getCell().getTop(); | var minTop = minItem.getCell().getTop(); | ||
| var minLeft = minItem.getCell().getLeft(); | var minLeft = minItem.getCell().getLeft(); | ||
| + | /* find the topmost leftmost shortcut */ | ||
| for ( ; i < count; i+=1 ) | for ( ; i < count; i+=1 ) | ||
| { | { | ||
| Line 46: | Line 48: | ||
| continue; | continue; | ||
| var r = item.getCell(); | var r = item.getCell(); | ||
| + | /* check if it is the topmost leftmost */ | ||
| if ( (r.getTop() < minTop) && (r.getLeft() < minLeft) ) | if ( (r.getTop() < minTop) && (r.getLeft() < minLeft) ) | ||
| { | { | ||
| + | minTop = r.getTop(); | ||
| + | minLeft = r.getLeft(); | ||
| minItem = item; | minItem = item; | ||
| return; | return; | ||
| } | } | ||
| } | } | ||
| + | /* launch app */ | ||
| minItem.launch(); | minItem.launch(); | ||
| </code> | </code> | ||