text
stringlengths
0
15.7k
source
stringlengths
6
112
on create_table(table_name, column_names_array)
sqlite_class.applescript
set column_names_string to my commaSepQuotedString(column_names_array)
sqlite_class.applescript
set statement to "create table if not exists " & table_name & "(" & column_names_string & "); "
sqlite_class.applescript
executeSQL(statement)
sqlite_class.applescript
end create_table
sqlite_class.applescript
on insert(table_name, the_values)
sqlite_class.applescript
set the_values to my commaSepQuotedString(the_values)
sqlite_class.applescript
set statement to "insert into " & table_name & " values(" & the_values & "); "
sqlite_class.applescript
display dialog "There was an error while inserting." & return & e
sqlite_class.applescript
on update(table_name, the_fields, the_values, search_field, search_value)
sqlite_class.applescript
repeat with i from 1 to count of the_fields
sqlite_class.applescript
set this_item to item i of the_fields
sqlite_class.applescript
set statement to ("UPDATE " & table_name & " set " & this_item & " = '" & ¬
sqlite_class.applescript
item i of the_values & "' WHERE " & search_field & " = '" & search_value & "'; " as string)
sqlite_class.applescript
on addColumn(table_name, col_name)
sqlite_class.applescript
set statement to ("ALTER table " & table_name & " add " & col_name & "; " as string)
sqlite_class.applescript
end addColumn
sqlite_class.applescript
on select_(column_names_array, table_name, search_field, search_value)
sqlite_class.applescript
set column_names_string to my commaSepString(column_names_array)
sqlite_class.applescript
set statement to ("SELECT " & column_names_string & " FROM " & table_name & ¬
sqlite_class.applescript
" WHERE " & search_field & " = '" & search_value & "'; " as string)
sqlite_class.applescript
return executeSQL(statement)
sqlite_class.applescript
end select_
sqlite_class.applescript
on select_all(table_name)
sqlite_class.applescript
set statement to ("SELECT * FROM " & table_name & " ; " as string)
sqlite_class.applescript
set execute to (executeSQL(statement))
sqlite_class.applescript
return my tidStuff(return, execute)
sqlite_class.applescript
end select_all
sqlite_class.applescript
on select_all_where(table_name, search_field, search_value)
sqlite_class.applescript
set statement to ("SELECT * FROM " & table_name & " WHERE " & ¬
sqlite_class.applescript
search_field & " = " & search_value & " ; " as string)
sqlite_class.applescript
end select_all_where
sqlite_class.applescript
on delete_where(table_name, search_field, search_value)
sqlite_class.applescript
set statement to ("DELETE FROM " & table_name & " WHERE " & ¬
sqlite_class.applescript
end delete_where
sqlite_class.applescript
on delete_every_row(table_name)
sqlite_class.applescript
set statement to ("DELETE FROM " & table_name & "; " as string)
sqlite_class.applescript
end delete_every_row
sqlite_class.applescript
on delete_table(table_name)
sqlite_class.applescript
set statement to ("DELETE " & table_name & "; " as string)
sqlite_class.applescript
end delete_table
sqlite_class.applescript
on executeSQL(statement)
sqlite_class.applescript
return (do shell script HEAD & statement & TAIL)
sqlite_class.applescript
end executeSQL
sqlite_class.applescript
on tidStuff(paramHere, textHere)
sqlite_class.applescript
set OLDtid to AppleScript's text item delimiters
sqlite_class.applescript
set AppleScript's text item delimiters to paramHere
sqlite_class.applescript
set theItems to text items of textHere
sqlite_class.applescript
set AppleScript's text item delimiters to OLDtid
sqlite_class.applescript
end tidStuff
sqlite_class.applescript
on commaSepQuotedString(the_array)
sqlite_class.applescript
set return_string to ""
sqlite_class.applescript
if length of the_array > 1 then
sqlite_class.applescript
repeat with i from 1 to count of the_array
sqlite_class.applescript
set this_item to item i of the_array
sqlite_class.applescript
set return_string to return_string & "'" & this_item & "', "
sqlite_class.applescript
return text 1 thru -3 of return_string as string
sqlite_class.applescript
return item 1 of the_array
sqlite_class.applescript
end commaSepQuotedString
sqlite_class.applescript
on commaSepString(the_array)
sqlite_class.applescript
set return_string to return_string & this_item & ", "
sqlite_class.applescript
end commaSepString
sqlite_class.applescript
set ext to text -4 thru end of baseName
Get Ext Of Selection.applescript
ext
Get Ext Of Selection.applescript
set leftHorizon to 0 as integer ## left-most horizontal
set_bounds.scpt
set topVert to 25 as integer ## top vertical
set_bounds.scpt
set rightMost to 1000 as integer ## right-most horizontal
set_bounds.scpt
set bottomVert to 500 as integer ## bottom vertical
set_bounds.scpt
set bounds of windows of workbook 1 to {leftHorizon, topVert, rightMost, bottomVert}
set_bounds.scpt
set t to make new terminal
SpawniTerm.applescript
write text "cd \"" & item 1 of argv & "\"; clear; pwd"
SpawniTerm.applescript
let method = "execute";
DraftsExampleScript2.applescript
let script = `on execute(bodyHTML)
DraftsExampleScript2.applescript
return "Yeah!"
DraftsExampleScript2.applescript
end execute`;
DraftsExampleScript2.applescript
let html = draft.processTemplate("%%[[draft]]%%");
DraftsExampleScript2.applescript
let runner = AppleScript.create(script);
DraftsExampleScript2.applescript
if (runner.execute(method, [html])) { // the AppleScript ran without error // if the script returned a result, it's available... alert(runner.lastResult); }
DraftsExampleScript2.applescript
else { alert(runner.lastError); }
DraftsExampleScript2.applescript
open location "https://translate.yandex.ru/?text=" & argv
dict.applescript
tell application "Music" to quit
EjectAllDiscs BigSur.scpt
if application "Microsoft PowerPoint" is running then
EjectAllDiscs BigSur.scpt
tell application "Microsoft PowerPoint" to quit
EjectAllDiscs BigSur.scpt
if application "Microsoft Excel" is running then
EjectAllDiscs BigSur.scpt
tell application "Microsoft Excel" to quit
EjectAllDiscs BigSur.scpt
if application "Microsoft OneNote" is running then
EjectAllDiscs BigSur.scpt
tell application "Microsoft OneNote" to quit
EjectAllDiscs BigSur.scpt
if application "Keeper Password Manager" is running then
EjectAllDiscs BigSur.scpt
tell application "Keeper Password Manager" to quit
EjectAllDiscs BigSur.scpt
if application "Preview" is running then
EjectAllDiscs BigSur.scpt
tell application "Preview" to quit
EjectAllDiscs BigSur.scpt
if application "Script Editor" is running then
EjectAllDiscs BigSur.scpt
tell process "ControlCenter"
EjectAllDiscs BigSur.scpt
set BluetoothButton to menu bar item "Bluetooth" of menu bar 1
EjectAllDiscs BigSur.scpt
click BluetoothButton
EjectAllDiscs BigSur.scpt
set OnSwitch to checkbox "Bluetooth" of group 1 of window "Control Center"
EjectAllDiscs BigSur.scpt
if value of OnSwitch is 0 then
EjectAllDiscs BigSur.scpt
click OnSwitch
EjectAllDiscs BigSur.scpt
set TheCheckbox to checkbox "Belkin G22" of scroll area 1 of group 1 of window "Control Center"
EjectAllDiscs BigSur.scpt
if value of TheCheckbox is 1 then click TheCheckbox
EjectAllDiscs BigSur.scpt