text
stringlengths
0
15.7k
source
stringlengths
6
112
return groupPubs
Update_group_publications_from_attachment_name.applescript
end publicationsForGroupByName
Update_group_publications_from_attachment_name.applescript
on firstAttachmentNameFromPublication(aPublication)
Update_group_publications_from_attachment_name.applescript
if aPublication is missing value then return ""
Update_group_publications_from_attachment_name.applescript
set pubAttachments to attachment items of aPublication
Update_group_publications_from_attachment_name.applescript
if pubAttachments is {} then return ""
Update_group_publications_from_attachment_name.applescript
set anAttachment to first item of pubAttachments
Update_group_publications_from_attachment_name.applescript
set attachmentName to name of anAttachment
Update_group_publications_from_attachment_name.applescript
return attachmentName
Update_group_publications_from_attachment_name.applescript
end firstAttachmentNameFromPublication
Update_group_publications_from_attachment_name.applescript
on setKeywordsForPublication(aPublication, keywordsList)
Update_group_publications_from_attachment_name.applescript
if aPublication is missing value then return false
Update_group_publications_from_attachment_name.applescript
if keywordsList is missing value or keywordsList is {} then return false
Update_group_publications_from_attachment_name.applescript
set keywordsString to my mergeTextItems(keywordsList, linefeed)
Update_group_publications_from_attachment_name.applescript
if (not replaceExistingKeywords) then
Update_group_publications_from_attachment_name.applescript
set existingKeywords to keywords of aPublication
Update_group_publications_from_attachment_name.applescript
if existingKeywords is not "" then
Update_group_publications_from_attachment_name.applescript
set keywordsString to existingKeywords & linefeed & keywordsString
Update_group_publications_from_attachment_name.applescript
set keywords of aPublication to keywordsString
Update_group_publications_from_attachment_name.applescript
end setKeywordsForPublication
Update_group_publications_from_attachment_name.applescript
on substringsFromString(aString, searchPattern, splitDelim)
Update_group_publications_from_attachment_name.applescript
if aString is missing value or aString is "" then return {}
Update_group_publications_from_attachment_name.applescript
if searchPattern is missing value or searchPattern is "" then return {}
Update_group_publications_from_attachment_name.applescript
set substring to my regexMatch(aString, searchPattern)
Update_group_publications_from_attachment_name.applescript
if substring is not "" then
Update_group_publications_from_attachment_name.applescript
set substrings to my splitText(substring, splitDelim)
Update_group_publications_from_attachment_name.applescript
return substrings
Update_group_publications_from_attachment_name.applescript
end substringsFromString
Update_group_publications_from_attachment_name.applescript
use framework "Foundation" -- required for the AppleScriptObjC handlers
Update_group_publications_from_attachment_name.applescript
fmGUI_CustomFunctions_EditFunction({})
fmGUI_CustomFunctions_EditFunction.applescript
on fmGUI_CustomFunctions_EditFunction(prefs)
fmGUI_CustomFunctions_EditFunction.applescript
set defaultPrefs to {functionName:null, functionOldName:null, doNotChangeExisting:false, availability:"ALL", parameterList:{}, calcCode:null, doNotUpdateIfVersion:null}
fmGUI_CustomFunctions_EditFunction.applescript
set foundFunction to false
fmGUI_CustomFunctions_EditFunction.applescript
set renameFunction to false
fmGUI_CustomFunctions_EditFunction.applescript
set editWindowName to "Edit Custom Function"
fmGUI_CustomFunctions_EditFunction.applescript
set functionName to functionName of prefs
fmGUI_CustomFunctions_EditFunction.applescript
if doNotChangeExisting of prefs then error "found function '" & functionName & "', but not allowed to change, so handler should not be called" number -1024
fmGUI_CustomFunctions_EditFunction.applescript
set editButton to first button of window 1 whose name begins with "Edit"
fmGUI_CustomFunctions_EditFunction.applescript
set newButton to first button of window 1 whose name begins with "New"
fmGUI_CustomFunctions_EditFunction.applescript
if fmGUI_CustomFunctions_SelectFunction({functionName:functionName}) then
fmGUI_CustomFunctions_EditFunction.applescript
set foundFunction to true
fmGUI_CustomFunctions_EditFunction.applescript
set clickCondition to "found by standard name"
fmGUI_CustomFunctions_EditFunction.applescript
if not foundFunction and functionOldName of prefs is not null then
fmGUI_CustomFunctions_EditFunction.applescript
if fmGUI_CustomFunctions_SelectFunction({functionName:functionOldName of prefs}) then
fmGUI_CustomFunctions_EditFunction.applescript
set renameFunction to true
fmGUI_CustomFunctions_EditFunction.applescript
set clickCondition to "found by OLD name"
fmGUI_CustomFunctions_EditFunction.applescript
if not foundFunction then
fmGUI_CustomFunctions_EditFunction.applescript
set clickCondition to "new function"
fmGUI_CustomFunctions_EditFunction.applescript
if not windowWaitUntil_FrontIS({windowName:editWindowName}) then error "window wait timed out from condition: " & clickCondition number -1024
fmGUI_CustomFunctions_EditFunction.applescript
if doNotUpdateIfVersion of prefs is not null then
fmGUI_CustomFunctions_EditFunction.applescript
set existingCalc to value of text area 1 of scroll area 4 of window 1
fmGUI_CustomFunctions_EditFunction.applescript
set cfExistingVersion to getTextBetween({sourceTEXT:existingCalc, beforeText:"// version ", afterText:return})
fmGUI_CustomFunctions_EditFunction.applescript
if (offset of "," in cfExistingVersion) is greater than 0 then set cfExistingVersion to item 1 of parseChars({cfExistingVersion, ","})
fmGUI_CustomFunctions_EditFunction.applescript
if cfExistingVersion is equal to doNotUpdateIfVersion of prefs then
fmGUI_CustomFunctions_EditFunction.applescript
return false -- did NOT need to update.
fmGUI_CustomFunctions_EditFunction.applescript
if functionName is not null then
fmGUI_CustomFunctions_EditFunction.applescript
if renameFunction then
fmGUI_CustomFunctions_EditFunction.applescript
set value of text field 1 of window 1 to functionName
fmGUI_CustomFunctions_EditFunction.applescript
if calcCode of prefs is not null then
fmGUI_CustomFunctions_EditFunction.applescript
set value of text area 1 of scroll area 4 of window 1 to calcCode of prefs
fmGUI_CustomFunctions_EditFunction.applescript
set parameterList to parameterList of prefs
fmGUI_CustomFunctions_EditFunction.applescript
if (count of parameterList) is not 0 then
fmGUI_CustomFunctions_EditFunction.applescript
repeat with paramNum from 1 to count of parameterList
fmGUI_CustomFunctions_EditFunction.applescript
set paramName to contents of item paramNum of parameterList
fmGUI_CustomFunctions_EditFunction.applescript
select row paramNum of table 1 of scroll area 3 of window 1
fmGUI_CustomFunctions_EditFunction.applescript
set paramNameTextField to text field 2 of window 1
fmGUI_CustomFunctions_EditFunction.applescript
if value of paramNameTextField is not equal to paramName then
fmGUI_CustomFunctions_EditFunction.applescript
set (value of paramNameTextField) to item paramNum of parameterList
fmGUI_CustomFunctions_EditFunction.applescript
click (first button of window 1 whose description is "Edit parameter")
fmGUI_CustomFunctions_EditFunction.applescript
error "unable to fmGUI_CustomFunctions_EditFunction '" & functionName & "' - " & errMsg number errNum
fmGUI_CustomFunctions_EditFunction.applescript
end fmGUI_CustomFunctions_EditFunction
fmGUI_CustomFunctions_EditFunction.applescript
tell application "htcLib" to fmGUI_CustomFunctions_SelectFunction(prefs)
fmGUI_CustomFunctions_EditFunction.applescript
tell application "htcLib" to fmGUI_ObjectClick_Button({buttonRef:my coerceToString(buttonRef of prefs)} & prefs)
fmGUI_CustomFunctions_EditFunction.applescript
set _url to (item 1 of argv)
safari-google-song.osa.txt
set _url to "play.google.com"
safari-google-song.osa.txt
set tabsList to front window's tabs as list
safari-google-song.osa.txt
set currHost to do Javascript "window.location.host" in currTab
safari-google-song.osa.txt
if (currHost = _url) then set raw_title to do Javascript "document.title" in currTab
safari-google-song.osa.txt
set song to replace_chars(raw_title, " - Google Play Music", "")
safari-google-song.osa.txt
log ("♪ " & song & " ♫")
safari-google-song.osa.txt
log "There's no song playing"
safari-google-song.osa.txt
script SQLite
sqlite_class.applescript
property SUPPORT_FOLDER : missing value
sqlite_class.applescript
property FOLDER_NAME : missing value
sqlite_class.applescript
property DATABASE_NAME : missing value
sqlite_class.applescript
property FILE_PATH : missing value
sqlite_class.applescript
property HEAD : missing value
sqlite_class.applescript
property TAIL : quote
sqlite_class.applescript
on createBaseFolder()
sqlite_class.applescript
set SUPPORT_FOLDER to (path to application support from user domain)
sqlite_class.applescript
set folder_path to (SUPPORT_FOLDER & FOLDER_NAME) as string
sqlite_class.applescript
if not (exists folder folder_path) then
sqlite_class.applescript
make folder at SUPPORT_FOLDER with properties {name:FOLDER_NAME}
sqlite_class.applescript
end createBaseFolder
sqlite_class.applescript
on setHead()
sqlite_class.applescript
set f_path to SUPPORT_FOLDER & FOLDER_NAME & ":" & DATABASE_NAME & ".db" as string
sqlite_class.applescript
set FILE_PATH to quoted form of POSIX path of f_path
sqlite_class.applescript
set file_location to space & FILE_PATH & space
sqlite_class.applescript
set HEAD to "sqlite3" & file_location & quote
sqlite_class.applescript
end setHead
sqlite_class.applescript