text
stringlengths
0
15.7k
source
stringlengths
6
112
set theValuePassed to __dataIntegrityCheck(theValue)
ASdictionary.applescript
if not theKeyPassed or not theValuePassed then
ASdictionary.applescript
if verboseFlag then
ASdictionary.applescript
log ("ASDictionary ERROR: A key-value pair had an error: index: " & thisKey & ", key:" & theKey as string) & ", value:" & theValue as string
ASdictionary.applescript
end dictionaryIntegrityCheck
ASdictionary.applescript
to __dataIntegrityCheck(newData) -- (object) as boolean
ASdictionary.applescript
if newData = null or newData = missing value then
ASdictionary.applescript
set itemCount to (count newData)
ASdictionary.applescript
if itemCount = 0 then
ASdictionary.applescript
end __dataIntegrityCheck
ASdictionary.applescript
if val ≥ __unsupported_chr or val ≤ 1 then
ASdictionary.applescript
on __mergeSort(m)
ASdictionary.applescript
set n to length of m
ASdictionary.applescript
if n ≤ 1 then -- less than or equal to
ASdictionary.applescript
return m
ASdictionary.applescript
set firstList to {}
ASdictionary.applescript
set secondList to {}
ASdictionary.applescript
set middleIndex to n div 2
ASdictionary.applescript
repeat with x from 1 to middleIndex
ASdictionary.applescript
copy item x of m to end of firstList
ASdictionary.applescript
repeat with x from middleIndex + 1 to n
ASdictionary.applescript
copy item x of m to end of secondList
ASdictionary.applescript
set firstList to my __mergeSort(firstList)
ASdictionary.applescript
set secondList to my __mergeSort(secondList)
ASdictionary.applescript
set resultList to my __merge(firstList, secondList)
ASdictionary.applescript
end __mergeSort
ASdictionary.applescript
on __merge(leftList, rightList)
ASdictionary.applescript
repeat while length of leftList > 0 and length of rightList > 0
ASdictionary.applescript
set a to first item of leftList
ASdictionary.applescript
set b to first item of rightList
ASdictionary.applescript
if a ≤ b then -- less than or equal to
ASdictionary.applescript
copy a to end of resultList
ASdictionary.applescript
set leftList to rest of leftList
ASdictionary.applescript
copy b to end of resultList
ASdictionary.applescript
set rightList to rest of rightList
ASdictionary.applescript
if length of leftList > 0 then
ASdictionary.applescript
repeat with x in leftList
ASdictionary.applescript
copy contents of x to end of resultList
ASdictionary.applescript
if length of rightList > 0 then
ASdictionary.applescript
repeat with x in rightList
ASdictionary.applescript
end __merge
ASdictionary.applescript
set TheListAsText to theList as text
ASdictionary.applescript
return TheListAsText
ASdictionary.applescript
return ASDictionary
ASdictionary.applescript
end MakeDictionary
ASdictionary.applescript
my duplicate_search_burn_test()
ASdictionary.applescript
property kFileList : {}
ASdictionary.applescript
on duplicate_search_burn_test()
ASdictionary.applescript
set kFileList to {}
ASdictionary.applescript
set source_folder to choose folder with prompt "Please select directory." --"Mac9:PDF_Library"
ASdictionary.applescript
my createList(source_folder)
ASdictionary.applescript
set dict to MakeDictionary() of me
ASdictionary.applescript
set lastPDF to (count kFileList)
ASdictionary.applescript
repeat with thisPDF from 1 to lastPDF
ASdictionary.applescript
set thePDF to item thisPDF of kFileList
ASdictionary.applescript
set keyExists to hasKey(thePDF) of dict
ASdictionary.applescript
if not keyExists then
ASdictionary.applescript
set valueSet to setValueForKey(0, thePDF) of dict
ASdictionary.applescript
set theCount to valueForKey(thePDF) of dict
ASdictionary.applescript
set updatedValueSet to setValueForKey(theCount, thePDF) of dict
ASdictionary.applescript
set theKeys to getKeys() of dict
ASdictionary.applescript
set theValues to getValues() of dict
ASdictionary.applescript
set lastKey to (count theKeys)
ASdictionary.applescript
log {item thisKey of theKeys, item thisKey of theValues}
ASdictionary.applescript
hashDescription() of dict
ASdictionary.applescript
end duplicate_search_burn_test
ASdictionary.applescript
on createList(mSource_folder)
ASdictionary.applescript
set item_list to get the name of every disk item of (mSource_folder as alias)
ASdictionary.applescript
set the_properties to ""
ASdictionary.applescript
set the_item to ((mSource_folder & the_item) as string) as alias
ASdictionary.applescript
set file_info to get info for the_item
ASdictionary.applescript
if visible of file_info is true then
ASdictionary.applescript
set file_name to displayed name of file_info
ASdictionary.applescript
if folder of file_info is true and file_name is not "Thumbnails" then
ASdictionary.applescript
my createList(the_item)
ASdictionary.applescript
set end of kFileList to file_name
ASdictionary.applescript
end createList
ASdictionary.applescript
on standard_burn_test()
ASdictionary.applescript
set testDictionary to MakeDictionary() of me
ASdictionary.applescript
tell testDictionary
ASdictionary.applescript
log "setValueForKey(oop, OOP)"
ASdictionary.applescript
set valueForKeySet to setValueForKey("oop", "OOP")
ASdictionary.applescript
log valueForKeySet
ASdictionary.applescript
log "addValuesForKeys({ack, greeble, ponies}, {ACK, GREEBLE, PONIES})"
ASdictionary.applescript
set valuesAddedForKeys to addValuesForKeys({"ack", "greeble", "ponies"}, {"ACK", "GREEBLE", "PONIES"})
ASdictionary.applescript
log valuesAddedForKeys
ASdictionary.applescript
log "setValueForKey(\"Luc Teyssier\", OOP)"
ASdictionary.applescript
set valueSetForKey to setValueForKey("Luc Teyssier", "OOP")
ASdictionary.applescript
log valueSetForKey
ASdictionary.applescript
log "set myValueForKey to valueForKey(OOP)"
ASdictionary.applescript
set myValueForKey to valueForKey("OOP")
ASdictionary.applescript
log myValueForKey
ASdictionary.applescript
log "set theKeys to getKeys()"
ASdictionary.applescript
set theKeys to getKeys()
ASdictionary.applescript
log theKeys
ASdictionary.applescript
log "set theKeysSorted to getKeysSorted()"
ASdictionary.applescript
set theKeysSorted to getKeysSorted()
ASdictionary.applescript
log theKeysSorted
ASdictionary.applescript
log "set theValues to getValues()"
ASdictionary.applescript
set theValues to getValues()
ASdictionary.applescript