
|
Tips and Tricks Download it now! |
|
Scripting DragStripThe following describes the scripting interface for DragStrip. Along with all of the sample scripts provided with the installer, it shows the extensive scripting support in DragStrip.
Required Suite : Events that every application should support
Open
Open the specified object(s).
Syntax: open referenceToFile
Example: tell application "DragStrip"
open alias "Hard Disk:DragStrip 3.6 Folder:Applications Strip"
end tell
Print
Print the specified object(s).
Syntax: print referenceToFile
Quit
Quit DragStrip.
Syntax: quit
Run
Sent to an application when it is double-clicked.
Syntax: run
Core Suite : Suite that applies to all applications
Close
Close an object.
Syntax: close referenceToObject [saving in referenceToFile]
Example: tell application "DragStrip"
close window "DragStrip Scrapbook"
saving in alias "Hard Disk:DragStrip Folder:DragStrip Scrapbook"
end tell
Count
Return the number of elements of a particular class within an object.
Syntax: count [each | every] className [(in | of) referenceToObject]
Result: integer
Example: tell application "DragStrip"
repeat with i from 1 to count windows
set zoomed of window i to false -- iconize all DragStrip windows
end repeat
end tell
Create
Create a new element.
Syntax: create [new] className
Result: referenceToObject
Example: tell application "DragStrip"
set theWindow to create new window -- sets theWindow as reference to a window
save theWindow in (new file) -- uses the reference to the window
end tell
Data Size
Return the size in bytes of an object.
Syntax: data size of referenceToObject [as className]
Result: integer
Example: get data size of contents of button 2 of window "Documents"
Delete
Delete an element from an object.
Syntax: delete referenceToObject
Example: tell window "Temporary Files" of application "DragStrip"
delete button 1 -- deletes the contents of button 1
end tell
Exists
Verify if an object exists.
Syntax: exists referenceToObject
referenceToObject exists
Result: boolean
Example: tell application "DragStrip"
if not (exists window "AppleScript Strip") then
open alias "Hard Disk:AppleScript Folder:AppleScript Strip"
end if
end tell
Get
Get the data for an object.
Syntax: get referenceToObject [as className]
Result: anything
Examples: get name of button 1 of window "Documents"
get contents of button 3 of window "DragStrip Scrapbook"
get size of window "Applications"
Save
Save an object.
Syntax: save referenceToObject [in referenceToFile]
Example: save window "untitled" in (new file)
Select
Select object(s).
Syntax: select referenceToObject
Example: select button 1 of window "Documents"
Set
Set an object's data.
Syntax: set referenceToObject to expression
Examples: set theName to name of button 1 of window "Pictures" -- get the name
set name of button 2 of window "Pictures" to theName -- set the name
set contents of button 5 of window "Document" to alias "Hard Disk:"
set the size of window "untitled - 1" to {6, 2}
set the background color of window "Applications" to {3241,340, 340}
Class application : An application program
Properties:
Allow Finder Drags A true value indicates the user is allowed to drag items from a
DragStrip window to the Finder. A false value indicates the user is not allowed to
drag items to the Finder.
Class: Boolean
Modifiable? Yes
Alphabetize Processes A true value indicates the processes on the Processes strip
are ordered alphabetically. A false value indicates the processes are not ordered
alphabetically.
Class: Boolean
Modifiable? Yes
Default Background Color An RGB value which specifies the background color of
the default window.
Class: List. See note below.
Modifiable? Yes
Default Button Background Color An RGB value which specifies the button background
color of the default window.
Class: List. See note below.
Modifiable? Yes
Default Button Dark Shadow Color An RGB value which specifies the button dark
shadow color of the default window.
Class: List. See note below.
Modifiable? Yes
Default Button Light Shadow Color An RGB value which specifies the button light
shadow color of the default window.
Class: List. See note below.
Modifiable? Yes
Default Button Style An integer specifying the icon style of the default window.
The values for the default button styles are:
1 - Raised
2 - Embossed
3 - Embossed rounded
4 - No button
5 - Beveled
6 - Tiled
Class: Integer
Modifiable? Yes
Default Icon Style An integer specifying the icon style of the default window.
The values for the default icon styles are:
0 - Large
1 - Small
2 - Large with name
3 - Small with name
4 - No icon with name
5 - Variable
Class: Integer
Modifiable? Yes
Default Labelled Buttons A true value indicates the buttons of the default window
will be drawn with the color of the label assigned to it. A false value indicates the
buttons will be not be drawn with the color of its label.
Class: Boolean
Modifiable? Yes
Default Labelled Icons A true value indicates the icons of the default window will
be drawn with the color of the label assigned to its button. A false value indicates
the icons will not be drawn with the color of its button's label.
Class: Boolean
Modifiable? Yes
Default Rotation A true value indicates the status bar and title bar of the default
window will be drawn vertically. A false value indicates the status bar and title bar
will be drawn horizontally.
Class: Boolean
Modifiable? Yes
Default Status Bar A true value indicates the status bar will be shown in the default
window. A false value indicates the status bar will not be shown.
Class: Boolean
Modifiable? Yes
Default Status Date A true value indicates the date will be shown in the status bar in
the default window. A false value indicates the date will not be shown in the status bar.
This only applies if the status bar is shown in the window.
Class: Boolean
Modifiable? Yes
Default Status Hilite Color An RGB value which specifies the status hilite color of the
default window.
Class: List. See note below.
Modifiable? Yes
Default Status Message Color An RGB value which specifies the status message color
of the default window.
Class: List. See note below.
Modifiable? Yes
Default Status Seconds A true value indicates the seconds will be shown in the status
bar in the default window. A false value indicates the seconds will not be shown in the
status bar. This only applies if the status bar and time are shown in the window.
Class: Boolean
Modifiable? Yes
Default Status Time A true value indicates the time will be shown in the status bar
in the default window. A false value indicates the time will not be shown in the
status bar. This only applies if the status bar is shown in the window.
Class: Boolean
Modifiable? Yes
Dim Unmounted Items A true value indicates that buttons with links to unmounted
disks will be dimmed. A false value indicates the buttons will not be dimmed.
Class: Boolean
Modifiable? Yes
Enable Hot Key For Quit A true value indicates the standard keystroke for quitting
DragStrip will be enabled. A false value indicates the keystroke will be disabled.
Class: Boolean
Modifiable? Yes
Frontmost A true value indicates DragStrip is the frontmost application. A
false value indicates DragStrip is not the frontmost application.
Class: Boolean
Modifiable? No
Hide Empty Buttons A true value indicates empty buttons are hidden on all windows.
A false value indicates empty buttons are not hidden.
Class: Boolean
Modifiable? Yes
Name The name of the application.
Class: String
Modifiable? No
Show Data On Buttons A true value indicates buttons are drawn showing its contents.
A false value indicates buttons are drawn without showing its contents. This only
applies to data clippings.
Class: Boolean
Modifiable? Yes
Show Only Applications A true value indicates only applications are shown on the
Processes strip. A false value indicates all processes are shown on the Processes
strip.
Class: Boolean
Modifiable? Yes
Version The version of the application.
Class: String
Modifiable? No
Element Classes:
Window by numeric index, by name.
Commands Handled:
Open, Print, Quit, Run, Get, Set
Example:
tell application "DragStrip"
set allow Finder drags to false
set alphabetize processes to true
set show data on buttons to true
end tell
Notes:
An RGB value is a list where the first integer specifies the intensity of red,
the second specifies the intensity of green and the third specifies the intensity
of blue. The intensity values range from 0 to 65535.
Class window : A window
Properties:
Anchor To Bottom A true value indicates the window is anchored to the bottom
of the screen. A false value indicates the window is not anchored to the bottom
of the screen.
Class: Boolean
Modifiable? Yes
Anchor To Right A true value indicates the window is anchored to the right of
the screen. A false value indicates the window is not anchored to the right of
the screen.
Class: Boolean
Modifiable? Yes
Background Color An RGB value which specifies the background color of the window
Class: List. See note below.
Modifiable? Yes
Bounds A list specifying the bounding rectangle of the window. The first
two integers are the coordinates of the top left corner and the last two
integers the coordinates of the bottom right corner of the window.
Class: List
Modifiable? Yes
Button Background Color An RGB value specifying the backgound color for the
buttons of the window.
Class: List. See note below.
Modifiable? Yes
Button Style An integer specifying the icon style of the window. The
values for the button styles are:
1 - Raised
2 - Embossed
3 - Embossed rounded
4 - No button
5 - Beveled
6 - Tiled
Class: Integer
Modifiable? Yes
Closeable A true value indicates the window is closeable. A false value
indicates the window is not closeable. All DragStrip windows are closeable.
Class: Boolean
Modifiable? No
Floating A true value indicates the window floats. A false value
indicates the window does not float. None of DragStrip's windows float.
Class: Boolean
Modifiable? No
Icon Style An integer specifying the icon style of the window. The values
for the icon styles are:
0 - Large
1 - Small
2 - Large with name
3 - Small with name
4 - No icon with name
5 - Variable
Class: Integer
Modifiable? Yes
Index An integer specifying the index of the window.
Class: Integer
Modifiable? No
Item Height An integer specifying the height of buttons on the window. This
property is only applicable to the variable size, small with name and large
with name button styles.
Class: Integer
Modifiable? Yes
Item Width An integer specifying the width of buttons on the window. This
property is only applicable to the variable size, small with name and large
with name button styles.
Class: Integer
Modifiable? Yes
Labeled Buttons A true value indicates the buttons are drawn with the color
of the label assigned to it. A false value indicates the buttons are not
drawn with the color of its label.
Class: Boolean
Modifiable? Yes
Labeled Icons A true value indicates the icons of the window are drawn with
the color of the label assigned to its button. A false value indicates the
icons are not drawn with the color of its button's label.
Class: Boolean
Modifiable? Yes
Modal A true value indicates the window is modal. A false value indicates
the window is not modal. None of DragStrip's windows are modal.
Class: Boolean
Modifiable? No
Name The name of the window as shown in the title bar.
Class: String
Modifiable? No
Position A list specifying the coordinates of the top left corner of the
window.
Class: List
Modifiable? Yes
Resizable A true value indicates the window is resizable. A false value
indicates the window is not resizable. All DragStrip windows, except for
the Processes strip, are resizable.
Class: Boolean
Modifiable? No
Rotation A true value indicates the status bar and title bar are drawn
vertically on the window. A false value indicates the status bar and title
bar are drawn horizontally on the window.
Class: Boolean
Modifiable? Yes
Size A list value specifying the dimensions of the window in columns and rows.
Class: List
Modifiable? Yes
Status Bar A true value indicates the status bar is shown in the window. A
false value indicates the status bar is not shown.
Class: Boolean
Modifiable? Yes
Status Date A true value indicates the date is shown in the status bar of the
window. A false value indicates the date is not shown in the status bar.
This only applies if the status bar is shown in the window.
Class: Boolean
Modifiable? Yes
Status Hilite Color An RGB value specifying the highlight color for the
status bar of the strip.
Class: List. See note below.
Modifiable? Yes
Status Message Color An RGB value specifying the color for the status
message of the window.
Class: List. See note below.
Modifiable? Yes
Status Seconds A true value indicates the seconds are shown in the status bar
of the window. A false value indicates the seconds are not shown in the
status bar. This only applies if the status bar and time are shown in the
window.
Class: Boolean
Modifiable? Yes
Status Time A true value indicates the time is shown in the status bar of the
window. A false value indicates the time is not shown in the status bar. This
only applies if the status bar is shown in the window.
Class: Boolean
Modifiable? Yes
Titled A true value indicates the window has a title bar. A false value
indicates the window does not have a title bar.
Class: Boolean
Modifiable? Yes
Visible A true value indicates the window is visible. A false value
indicates the window is not visible.
Class: Boolean
Modifiable? Yes
Zoomable A true value indicates the window is zoomable. A false value
indicates the window is not zoomable. All DragStrip windows are zoomable.
Class: Boolean
Modifiable? No
Zoomed A true value indicates the window is zoomed. A false value indicates
the window is not zoomed.
Class: Boolean
Modifiable? Yes
Element Classes:
Button by numeric index, by name.
Commands Handled:
Open, Close, Count, Create, Exists, Get, Save, Select, Set
Example:
tell application "DragStrip"
repeat with i from 1 to count windows
set icon style of window i to 3 -- Set icon style to small with name
set button style of window i to 4 -- Set button style to no button
end repeat
end tell
Notes:
An RGB value is a list where the first integer specifies the intensity of red,
the second specifies the intensity of green and the third specifies the intensity
of blue. The intensity values range from 0 to 65535.
Class button : a DragStrip button
Properties:
Contents The contents of the button
Class: If the button contains a PICT, sound or movie clipping, this
property specifies data formatted as PICT, snd , or moov. All other
button types contain strings.
Modifiable? Yes
Controlstrip Module A true value indicates the button contains a control
strip module. A false value indicates the button does not contain a control
strip module.
Class: Boolean
Modifiable? No
Dragstrip Addition A true value indicates the button contains a DragStrip
addition. A false value indicates the button does not contain a DragStrip addition.
Class: Boolean
Modifiable? No
Empty A true value indicates the button is empty. A false value indicates
the button is not empty.
Class: Boolean
Modifiable? No
Has Data A true value indicates the button contains a data clipping. A
false value indicates the button does not contain a data clipping.
Class: Boolean
Modifiable? No
Has File A true value indicates the button contains a link to an object
(file, folder, etc.) in the Finder. A false value indicates the button does
not contain a link to a Finder object.
Class: Boolean
Modifiable? No
Icon A data value formatted as ICON.
Class: Data
Modifiable? Yes
Index An integer specifying the index of the button.
Class: Integer
Modifiable? No
Label An integer from 0 to 7 specifying the index of the label of the button.
The index order follows the order in the Labels menu. Label 'None' has index 0.
Class: Integer
Modifiable? Yes
Name The name of the button.
Class: String
Modifiable? Yes
Position A list value specifying the position of the button in columns and rows.
The top left button has position {1, 1}.
Class: List
Modifiable? No
Process Hidden A true value indicates the process linked to the button is hidden.
A false value indicates the process is not hidden. This only applies to the
Processes strip.
Class: Boolean
Modifiable? No
Selected A true value indicates the button is selected. A false value
indicates the button is not selected.
Class: Boolean
Modifiable? Yes
Type An integer specifying the type of the button. The values for the
button types are:
"fldr" - Folder
"disk" - Disk
"appl" - Application
"doc " - Document
"adtn" - DragStrip addition
"strp" - Control strip module
"TEXT" - Text clipping
"PICT" - PICT clipping
"snd " - Sound clipping
"moov" - Movie item
"ofln" - Link to an item is in an offline volume
"empt" - Empty button
"unk " - Unknown item
Class: String
Modifiable? No
Element Classes:
None.
Commands Handled:
Copy, Count, Cut, Data Size, Delete, Exists, Get, Paste, Select, Set
Examples:
tell application "Microsoft Excel"
copy Chart 1 to theChart -- Copies chart as a picture
tell Application "DragStrip"
set contents of button 1 of window "Charts" to theChart
end tell
end tell
tell application "DragStrip"
if (type of button 2 of window "DragStrip Scrapbook" = "TEXT") then
select window "DragStrip Scrapbook" -- Make sure the window is frontmost
select button 2 of window "DragStrip Scrapbook" -- Select the button to copy
Copy
select button 3 of window "DragStrip Scrapbook" -- Select the button to paste
Paste
end if
end tell
Miscellaneous : Miscellaneous useful events.
Copy
Copies the selected items of the frontmost strip to the Clipboard.
Syntax: Copy
Cut
Copies the selected items of the frontmost strip to the Clipboard, then deletes them.
Syntax: Cut
Paste
Places the contents of the Clipboard into the selected button of the frontmost strip.
Syntax: Paste
Next
|
Last Updated: 07-Dec-98
Copyright © 1997-1998 Poppybank Software