Add Files

Add Files

The Add Files command adds a list of files to a database as digital resources. As files are added they are issued unique integer IDs. By default, certain types of files may be parsed and referenced files added/updated in the database. Optionally, information about files already in the database may also be updated.

Add Files list_of_files

[links link_option]

[update existing files update_option]

 

Result: digital_resource_ids

 

Arguments

Type

Description

list_of_files

List

List of files or folders as aliases, files specifications, or AppleShare file/folder paths.

link_option

Boolean

Add/update files referenced in this file. Default value is true.

update_option

Boolean

Update files in the list_of_files if they already exist in the database.

digital_resource_ids

List

Returns an integer list of digital resource IDs.

Example: Adding folders and files.

-- Adds two folders of files to the Virtual Ticket database.

tell application "Virtual Ticket 8.0" to
set ids1 to Add Files {"Jobs:000001 - Rockport Spring Cat:",¬
"Jobs:000002 - Builders Catalogue:Annual Report"}

-- Adds a single quark file with no references to other files
-- to the Virtual Ticket database.

set ids2 to Add Files¬
(alias "Jobs:000003 - Wellness and Fitness:Brochure")¬
with update existing files without links
end tell

 

Example: Adding and deleting a digital resource from a file collector field in a form.

-- Adds a digital resource to the Customer_Files file collector

-- field of job number 1.


tell application "Virtual Ticket 8.0"

set digitalResourcesIds to Add Files¬

{"Jobs:000001 - Rockport Spring Cat:Brochure"}¬

with links and update existing files

set job to Retrieve Object Record of type "Jobs" with id 1

set |Customer_Files| of job to |Customer_Files| of¬

job & digitalResourcesIds

Update Object Record of type "Jobs" with id 1 with fields job

end tell

-- Deletes a digital resource from the Customer_Files file collector

-- field of job number 1. Note the digital resource itself

-- is not deleted from the database.

 

tell application "Virtual Ticket 8.0"

set job to Retrieve Object Record of type "Jobs" with id 1

set digitalResourceIds to |Customer_Files| of job

set digitalResourcePaths to Get Digital Resource Paths¬

digitalResourceIds

set |Customer_Files| of job to {}

set i to 0

repeat with path in digitalResourcePaths

set i to i + 1

if ("Jobs:000001 - Rockport Spring Cat:Brochure" is not equal¬

to path as string) then

set |Customer_Files| of job to |Customer_Files| of job¬

& (item i of digitalResourceIds)

end if

end repeat

Update Object Record of type "Jobs" with id 1 with fields job

end tell

 


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.