text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
end getPreferences | Alfred Library.applescript |
on getBundleID() | Alfred Library.applescript |
if my isEmpty(my _bundle) then return missing value | Alfred Library.applescript |
return my _bundle | Alfred Library.applescript |
end getBundleID | Alfred Library.applescript |
on getData() | Alfred Library.applescript |
if my isEmpty(my _data) then return missing value | Alfred Library.applescript |
return _data | Alfred Library.applescript |
end getData | Alfred Library.applescript |
on getCache() | Alfred Library.applescript |
if my isEmpty(my _cache) then return missing value | Alfred Library.applescript |
return _cache | Alfred Library.applescript |
end getCache | Alfred Library.applescript |
on getVar(varName) | Alfred Library.applescript |
if my isEmpty((system attribute varName)) then return missing value | Alfred Library.applescript |
return (system attribute varName) as text | Alfred Library.applescript |
on to_json(a) | Alfred Library.applescript |
local r | Alfred Library.applescript |
local json | Alfred Library.applescript |
if (my q_is_empty(a)) and (not my q_is_empty(my _results)) then | Alfred Library.applescript |
set a to my _results | Alfred Library.applescript |
else if (my q_is_empty(a)) and (my q_is_empty(my _results)) then | Alfred Library.applescript |
set tab2 to tab & tab | Alfred Library.applescript |
set tab3 to tab & tab & tab | Alfred Library.applescript |
set tab4 to tab & tab & tab & tab | Alfred Library.applescript |
set json to "{\"items\": [" & return & return
repeat with itemRef in a
set r to contents of itemRef
set json to json & tab & "{" & return
if not q_is_empty(theUid of r) then
set json to json & tab2 & "\"uid\": \"" & encode(theUid of r) & "\"," & return
end if
set json to json & tab2 & "\"valid\": \"" & my encode(isVali... | Alfred Library.applescript |
if not q_is_empty(theVars of r) then | Alfred Library.applescript |
set vars to "" | Alfred Library.applescript |
set json to json & tab2 & "\"variables\" : {" & return
repeat with v in theVars of r
set varName to |name| of v
set varVal to value of v
set json to json & tab3 & "\"" & my encode(varName) & "\": \"" & my encode(varVal) & "\"," & return
end repeat
set json to json & tab2 & "}," & return | Alfred Library.applescript |
if not q_is_empty(theMods of r) then | Alfred Library.applescript |
set json to json & tab2 & "\"mods\": {" & return
set m to theMods of r
if not q_is_empty(cmd of m) then
set json to json & tab3 & "\"cmd\": {" & return
set json to json & tab4 & "\"valid\": \"" & my encode(isValid of cmd of m) & "\"," & return
set json to json & tab4 & "\"arg\": \"" & my encode(theArg of cmd of m) & "\... | Alfred Library.applescript |
if not q_is_empty(alt of m) then | Alfred Library.applescript |
set json to json & tab3 & "\"alt\": {" & return
set json to json & tab4 & "\"valid\": \"" & my encode(isValid of alt of m) & "\"," & return
set json to json & tab4 & "\"arg\": \"" & my encode(theArg of alt of m) & "\"," & return
set json to json & tab4 & "\"subtitle\": \"" & my encode(theSubtitle of alt of m) & "\"" & ... | Alfred Library.applescript |
if not q_is_empty(ctrl of m) then | Alfred Library.applescript |
set json to json & tab3 & "\"ctrl\": {" & return
set json to json & tab4 & "\"valid\": \"" & my encode(isValid of ctrl of m) & "\"," & return
set json to json & tab4 & "\"arg\": \"" & my encode(theArg of ctrl of m) & "\"," & return
set json to json & tab4 & "\"subtitle\": \"" & my encode(theSubtitle of ctrl of m) & "\"... | Alfred Library.applescript |
if not q_is_empty(shift of m) then | Alfred Library.applescript |
set json to json & tab3 & "\"shift\": {" & return
set json to json & tab4 & "\"valid\": \"" & my encode(isValid of shift of m) & "\"," & return
set json to json & tab4 & "\"arg\": \"" & my encode(theArg of shift of m) & "\"," & return
set json to json & tab4 & "\"subtitle\": \"" & my encode(theSubtitle of shift of m) &... | Alfred Library.applescript |
if not q_is_empty(fn of m) then | Alfred Library.applescript |
set json to json & tab3 & "\"fn\": {" & return
set json to json & tab4 & "\"valid\": \"" & my encode(isValid of fn of m) & "\"," & return
set json to json & tab4 & "\"arg\": \"" & my encode(theArg of fn of m) & "\"," & return
set json to json & tab4 & "\"subtitle\": \"" & my encode(theSubtitle of fn of m) & "\"" & retu... | Alfred Library.applescript |
set json to json & tab2 & "}" & return | Alfred Library.applescript |
if not q_is_empty(theText of r) then | Alfred Library.applescript |
set json to json & tab2 & "\"text\": {" & return
set t to theText of r
if not q_is_empty(theCopy of t) then
set json to json & tab3 & "\"copy\": \"" & my encode(theCopy of t) & "\"," & return
end if
if not q_is_empty(theLarge of t) then
set json to json & tab3 & "\"largetype\": \"" & my encode(theLarge of t) & "\"" & r... | Alfred Library.applescript |
set json to json & tab & "}," & return & return | Alfred Library.applescript |
set json to json & return & "]}" | Alfred Library.applescript |
end to_json | Alfred Library.applescript |
on getIconPath(theApp) | Alfred Library.applescript |
tell application "Finder" to set appnames to displayed name of every file in folder ((path to applications folder)) | Alfred Library.applescript |
if theApp = "Finder" then | Alfred Library.applescript |
set iconrecord to {theType:"fileicon", thePath:"/System/Library/CoreServices/Finder.app"} | Alfred Library.applescript |
else if theApp = "Global" then | Alfred Library.applescript |
set iconrecord to {theType:"file", thePath:my getPreferences() & "/resources/GlobalAppIcon.icns"} | Alfred Library.applescript |
else if theApp = "Script Editor" then | Alfred Library.applescript |
set iconrecord to {theType:"fileicon", thePath:"/Applications/Utilities/Script Editor.app"} | Alfred Library.applescript |
else if appnames contains theApp then | Alfred Library.applescript |
set iconrecord to {theType:"fileicon", thePath:"/Applications/" & theApp & ".app"} | Alfred Library.applescript |
set iconrecord to {theType:"file", thePath:(my getPreferences() & "/resources/BlankAppIcon.png")} | Alfred Library.applescript |
end getIconPath | Alfred Library.applescript |
on add_result given theUid:_uid, theArg:_arg, theTitle:_title, theSubtitle:_sub, theIcon:_icon, theAutocomplete:_auto, theType:_type, isValid:_valid, theQuicklook:_quicklook, theVars:_vars, theMods:_mods, theText:_text | Alfred Library.applescript |
if _uid is missing value then set _uid to "" | Alfred Library.applescript |
if _arg is missing value then set _arg to "" | Alfred Library.applescript |
if _title is missing value then set _title to "" | Alfred Library.applescript |
if _sub is missing value then set _sub to "" | Alfred Library.applescript |
if _icon is missing value then set _icon to "" | Alfred Library.applescript |
if _auto is missing value then set _auto to "" | Alfred Library.applescript |
if _type is missing value then set _type to "" | Alfred Library.applescript |
if _valid is missing value then set _valid to "yes" | Alfred Library.applescript |
set temp to {theUid:_uid, theArg:_arg, theTitle:_title, theSubtitle:_sub, theIcon:_icon, theAutocomplete:_auto, theType:_type, isValid:_valid, theQuicklook:_quicklook, theVars:_vars, theMods:_mods, theText:_text} | Alfred Library.applescript |
if my q_is_empty(_type) then | Alfred Library.applescript |
set temp's theType to missing value | Alfred Library.applescript |
set end of (my _results) to temp | Alfred Library.applescript |
end add_result | Alfred Library.applescript |
tell Workflow to run | Alfred Library.applescript |
end newWorkFlowWithBundle | Alfred Library.applescript |
return length of (my q_trim(str)) is 0 | Alfred Library.applescript |
on q_join(l, delim) | Alfred Library.applescript |
if class of l is not list or l is missing value then return "" | Alfred Library.applescript |
repeat with i from 1 to length of l | Alfred Library.applescript |
if item i of l is missing value then | Alfred Library.applescript |
set item i of l to "" | Alfred Library.applescript |
set output to l as text | Alfred Library.applescript |
end q_join | Alfred Library.applescript |
on q_split(s, delim) | Alfred Library.applescript |
set output to text items of s | Alfred Library.applescript |
end q_split | Alfred Library.applescript |
on q_file_exists(theFile) | Alfred Library.applescript |
if my q_path_exists(theFile) then | Alfred Library.applescript |
end q_file_exists | Alfred Library.applescript |
on q_folder_exists(theFolder) | Alfred Library.applescript |
if my q_path_exists(theFolder) then | Alfred Library.applescript |
end q_folder_exists | Alfred Library.applescript |
on q_path_exists(thePath) | Alfred Library.applescript |
if thePath is missing value or my q_is_empty(thePath) then return false | Alfred Library.applescript |
end q_path_exists | Alfred Library.applescript |
on q_is_empty(str) | Alfred Library.applescript |
end q_is_empty | Alfred Library.applescript |
on q_trim(str) | Alfred Library.applescript |
if class of str is not text or class of str is not string or str is missing value then return str | Alfred Library.applescript |
if str is "" then return str | Alfred Library.applescript |
repeat while str begins with " " | Alfred Library.applescript |
set str to items 2 thru -1 of str as text | Alfred Library.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.