-- ----------------------------------------------------------------------------------
-- This is the glue script code that is embedded into each AppleScript service
-- It contains global variables defining the various pasteboard types (using 
-- the same names as in the AppKit (e.g. NSStringPboardType).
--
-- Additionally, there are convenience subroutines that access and manipulate
-- the pasteboard. The ASContext class will automatically replace the strings
-- <APPNAME> with the name of the application that is hosting the plug-in.

property NSGeneralPboard            : "Apple CFPasteboard general"
property NSColorPboardType          : "NSColorPboardType"
property NSFileContentsPboardType   : "NSFileContentsPboardType"
property NSFilenamesPboardType      : "NSFilenamesPboardType"
property NSFontPboardType           : "NSFontPboardType"
property NSHTMLPboardType           : "NSHTMLPboardType"
property NSPDFPboardType            : "NSPDFPboardType"
property NSPICTPboardType           : "NSPICTPboardType"
property NSPostScriptPboardType     : "NSPostScriptPboardType"
property NSRTFDPboardType           : "NSRTFDPboardType"
property NSRTFPboardType            : "NSRTFPboardType"
property NSRulerPboardType          : "NSRulerPboardType"
property NSStringPboardType         : "NSStringPboardType"
property NSTabularTextPboardType    : "NSTabularTextPboardType"
property NSTIFFPboardType           : "NSTIFFPboardType"
property NSURLPboardType            : "NSURLPboardType"
property NSVCardPboardType          : "NSVCardPboardType"

on getPasteboardTypes(aPasteboard)
    tell application "<APPNAME>"
        return get types from pasteboard aPasteboard
    end tell
end getPasteboardTypes

on declarePasteboardTypes(aPasteboard, typeList)
    tell application "<APPNAME>"
        declare types typeList for pasteboard aPasteboard
    end tell
end declarePasteboardTypes

on readPasteboardString(aPasteboard, aPasteboardType)
    tell application "<APPNAME>"
        return read string from pasteboard aPasteboard as aPasteboardType
    end tell
end readPasteboardString

on writePasteboardString(aPasteboard, aPasteboardType, aValue)
    tell application "<APPNAME>"
        write string aValue to pasteboard aPasteboard as aPasteboardType
    end tell
end writePasteboardString

on readPasteboardList(aPasteboard, aPasteboardType)
    tell application "<APPNAME>"
        return read list from pasteboard aPasteboard as aPasteboardType
    end tell
end readPasteboardList

on writePasteboardList(aPasteboard, aPasteboardType, aValue)
    tell application "<APPNAME>"
        write list aValue to pasteboard aPasteboard as aPasteboardType
    end tell
end writePasteboardList

on readPasteboardRecord(aPasteboard, aPasteboardType)
    tell application "<APPNAME>"
        return read record from pasteboard aPasteboard as aPasteboardType
    end tell
end readPasteboardRecord

on writePasteboardRecord(aPasteboard, aPasteboardType, aValue)
    tell application "<APPNAME>"
        write record aValue to pasteboard aPasteboard as aPasteboardType
    end tell
end writePasteboardRecord

on readPasteboardData(aPasteboard, aPasteboardType)
    tell application "<APPNAME>"
        return read data from pasteboard aPasteboard as aPasteboardType
    end tell
end readPasteboardData

on writePasteboardData(aPasteboard, aPasteboardType, aValue)
    tell application "<APPNAME>"
        write data aValue to pasteboard aPasteboard as aPasteboardType
    end tell
end writePasteboardData

-- END OF GLUE
-- ----------------------------------------------------------------------------------



