text
stringlengths
0
15.7k
source
stringlengths
6
112
set AppleScript's text item delimiters to return
OpenPanel.applescript
set output to value as text
OpenPanel.applescript
set AppleScript's text item delimiters to tempTID
OpenPanel.applescript
display dialog output with title "Result" buttons {"OK"}
OpenPanel.applescript
end processItems
OpenPanel.applescript
to performPanel:sender -- run the panel on the main thread (so it can also be used in the Script Editor)
OpenPanel.applescript
set response to missing value
OpenPanel.applescript
my performSelectorOnMainThread:"getFileItems" withObject:(missing value) waitUntilDone:true
OpenPanel.applescript
processItems(response)
OpenPanel.applescript
end performPanel:
OpenPanel.applescript
to getFileItems() -- do the open panel thing
OpenPanel.applescript
tell current application's NSOpenPanel's openPanel()
OpenPanel.applescript
its setFloatingPanel:true
OpenPanel.applescript
its setTitle:"Panel Test"
OpenPanel.applescript
its setPrompt:"Choose" -- the button name
OpenPanel.applescript
its setMessage:"Choose some stuff:"
OpenPanel.applescript
if setup is missing value then -- only use default on the first run
OpenPanel.applescript
its setDirectoryURL:(current application's NSURL's alloc's initFileURLWithPath:defaultDirectory)
OpenPanel.applescript
set setup to true
OpenPanel.applescript
repeat with aButton in buttonList
OpenPanel.applescript
(its setValue:(aButton's value) forKey:(aButton's selector))
OpenPanel.applescript
my makeAccessory(it)
OpenPanel.applescript
its setAllowsMultipleSelection:true
OpenPanel.applescript
set theResult to its runModal() -- show the panel
OpenPanel.applescript
if theResult is (current application's NSFileHandlingPanelCancelButton) then return -- cancel button
OpenPanel.applescript
set response to its URLs as list -- pass on the list of file objects
OpenPanel.applescript
end getFileItems
OpenPanel.applescript
to makeAccessory(panel) -- make an accessory view for the panel
OpenPanel.applescript
tell (current application's NSBox's alloc's initWithFrame:[{0, 0}, {285, 70}])
OpenPanel.applescript
its setTitlePosition:0
OpenPanel.applescript
repeat with aButton in buttonList -- add some buttons
OpenPanel.applescript
set check to my makeCheckbox(aButton's title, aButton's frame)
OpenPanel.applescript
set check's state to aButton's value
OpenPanel.applescript
(its addSubview:check)
OpenPanel.applescript
panel's setAccessoryView:it
OpenPanel.applescript
end makeAccessory
OpenPanel.applescript
to makeCheckbox(title, frame) -- make a checkbox button
OpenPanel.applescript
if newer then -- available 10.12+
OpenPanel.applescript
set button to current application's NSButton's checkboxWithTitle:title target:me action:"doCheckBox:"
OpenPanel.applescript
button's setFrame:frame
OpenPanel.applescript
else -- old style
OpenPanel.applescript
set button to current application's NSButton's alloc's initWithFrame:frame
OpenPanel.applescript
button's setButtonType:(current application's NSSwitchButton)
OpenPanel.applescript
button's setTitle:title
OpenPanel.applescript
button's setTarget:me
OpenPanel.applescript
button's setAction:"doCheckBox:"
OpenPanel.applescript
return button
OpenPanel.applescript
end makeCheckbox
OpenPanel.applescript
on doCheckbox:sender -- handle checkbox changes in the accessoryView
OpenPanel.applescript
tell sender's |window|() -- 'window' is a reserved AppleScript term
OpenPanel.applescript
if aButton's title is (sender's title as text) then
OpenPanel.applescript
(its (parentWindow's setValue:(sender's intValue as boolean) forKey:(aButton's selector)))
OpenPanel.applescript
display() -- update
OpenPanel.applescript
end doCheckbox:
OpenPanel.applescript
on quit
OpenPanel.applescript
set setup to missing value -- reset for next time
OpenPanel.applescript
continue quit
OpenPanel.applescript
end quit
OpenPanel.applescript
if not (disk mountedDiskName exists) then
Mount Drive and Search 2 copy.applescript
mount volume drivePath
Mount Drive and Search 2 copy.applescript
display notification "'" & mountedDiskName & "' has been mounted"
Mount Drive and Search 2 copy.applescript
do shell script "ls /Volumes/" & mountedDiskName
Mount Drive and Search 2 copy.applescript
get paragraphs of result
Mount Drive and Search 2 copy.applescript
set folderList to result
Mount Drive and Search 2 copy.applescript
rest of folderList
Mount Drive and Search 2 copy.applescript
set newFolderList to items 2 thru -1 of folderList
Mount Drive and Search 2 copy.applescript
set volumeSearch to choose from list (result) with prompt "Choose a Volume folder to search:" OK button name "Search"
Mount Drive and Search 2 copy.applescript
if result is false then
Mount Drive and Search 2 copy.applescript
display dialog "This is not the drive you are looking for."
Mount Drive and Search 2 copy.applescript
else if volumeSearch is result then
Mount Drive and Search 2 copy.applescript
tell application "Alfred 3" to search searchPath & result
Mount Drive and Search 2 copy.applescript
on open theItems
OpenHandler_V1.applescript
repeat with thisItem in theItems
OpenHandler_V1.applescript
tell application "Finder" to update thisItem
OpenHandler_V1.applescript
tell application "Numbers"
Numbers to Pages (Generic).applescript
set sourceFile to id of (open (choose file with prompt "Source File"))
Numbers to Pages (Generic).applescript
tell document id sourceFile
Numbers to Pages (Generic).applescript
tell sheet 1
Numbers to Pages (Generic).applescript
tell table 1
Numbers to Pages (Generic).applescript
set numberOfPages to (count of cells of column 1) - 2
Numbers to Pages (Generic).applescript
tell row 1
Numbers to Pages (Generic).applescript
set labels to {}
Numbers to Pages (Generic).applescript
repeat with i from 1 to count of cells
Numbers to Pages (Generic).applescript
if value of cell i is not missing value then
Numbers to Pages (Generic).applescript
set end of labels to value of cell i
Numbers to Pages (Generic).applescript
set classColumnName to choose from list labels with prompt "Please tell me which field is the class name."
Numbers to Pages (Generic).applescript
set classColumnName to item 1 of classColumnName
Numbers to Pages (Generic).applescript
repeat with i from 1 to count of columns
Numbers to Pages (Generic).applescript
if value of cell i contains classColumnName then
Numbers to Pages (Generic).applescript
set classColumn to column of cell 10
Numbers to Pages (Generic).applescript
tell classColumn
Numbers to Pages (Generic).applescript
set classesWithDuplicates to value of cells
Numbers to Pages (Generic).applescript
set classNames to my addr(classesWithDuplicates)
Numbers to Pages (Generic).applescript
set chosenClass to choose from list classNames with prompt "Please tell me which class you want to process."
Numbers to Pages (Generic).applescript
set chosenClass to item 1 of chosenClass
Numbers to Pages (Generic).applescript
set rowsToProcess to {}
Numbers to Pages (Generic).applescript
repeat with i from 1 to (count of cells of classColumn)
Numbers to Pages (Generic).applescript
if value of cell i of classColumn is chosenClass then
Numbers to Pages (Generic).applescript
set end of rowsToProcess to value of cells of row i
Numbers to Pages (Generic).applescript
tell application "Pages"
Numbers to Pages (Generic).applescript