text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
output unreadString
|
lns3.scpt
|
say unreadString
|
lns3.scpt
|
set currentDate to current date
|
lns3.scpt
|
set amPM to "AM"
|
lns3.scpt
|
set currentHour to (currentDate's hours)
|
lns3.scpt
|
set currentMinutes to currentDate's minutes
|
lns3.scpt
|
if (currentHour ≥ 12 and currentHour < 24) then
|
lns3.scpt
|
set amPM to "PM"
|
lns3.scpt
|
if currentMinutes < 10 then
|
lns3.scpt
|
set currentMinutes to ("0" & currentMinutes) as text
|
lns3.scpt
|
if currentHour is equal to 0 then
|
lns3.scpt
|
set currentHour to 12
|
lns3.scpt
|
if (currentHour > 12) then
|
lns3.scpt
|
set currentHour to (currentHour - 12)
|
lns3.scpt
|
set currentTime to ((currentDate's month) as text) & " " & ((currentDate's day) as text) & ", " & (currentHour as text) & ":" & ((currentMinutes) as text) & " " & amPM as text
|
lns3.scpt
|
output currentTime
|
lns3.scpt
|
say currentTime
|
lns3.scpt
|
property carriage_return : return as text
|
lns3.scpt
|
property message_A : "These scripts will insert standard AppleScript routines into the front document " & ¬
|
lns3.scpt
|
"of the Script Editor application." & ¬
|
lns3.scpt
|
"If there is text selected in the front document, the inserted routine will be wrapped around the selected text. " & ¬
|
lns3.scpt
|
"Otherwise, the inserted routine will be placed at the current cursor location."
|
lns3.scpt
|
set CR to ASCII character 13
|
lns3.scpt
|
set NL to ASCII character 10
|
lns3.scpt
|
set the target_string to "--XXXX"
|
lns3.scpt
|
set the selected_text to contents of selection
|
lns3.scpt
|
if the selected_text is not "" then
|
lns3.scpt
|
if BlockStart and BlockEnd then
|
lns3.scpt
|
set contents of selection to characters 4 through -4 of selected_text as text
|
lns3.scpt
|
set contents of selection to characters 3 through -3 of selected_text as text
|
lns3.scpt
|
set SelectionLength to length of selected_text
|
lns3.scpt
|
set BlockEndOffset to SelectionLength - ¬
|
lns3.scpt
|
(offset of ")*" in (reverse of (characters of selected_text) as text))
|
lns3.scpt
|
log {BlockStartOffset, BlockEndOffset, SelectionLength}
|
lns3.scpt
|
if BlockStartOffset is less than BlockEndOffset then
|
lns3.scpt
|
if BlockStart then
|
lns3.scpt
|
set Newtext to (characters 3 through (BlockEndOffset - 1) of selected_text as text) & ¬
|
lns3.scpt
|
characters (BlockEndOffset + 2) through -1 of selected_text as text
|
lns3.scpt
|
set contents of selection to Newtext
|
lns3.scpt
|
if BlockEnd then
|
lns3.scpt
|
set Newtext to (characters 1 through (BlockStartOffset - 1) of selected_text as text) & ¬
|
lns3.scpt
|
characters (BlockStartOffset + 2) through -3 of selected_text as text
|
lns3.scpt
|
set Newtext to ((characters 1 through (BlockStartOffset - 1) of selected_text as text) & ¬
|
lns3.scpt
|
characters (BlockStartOffset + 2) through (BlockEndOffset - 1) of selected_text as text) & ¬
|
lns3.scpt
|
if true then
|
lns3.scpt
|
if the last character of selected_text is in {CR, NL} then
|
lns3.scpt
|
set contents of selection to return & ¬
|
lns3.scpt
|
display dialog "Select some text before invoking this script command." with icon stop buttons "OK" default button 1
|
lns3.scpt
|
set the contents of the selection of the front document to this_text
|
lns3.scpt
|
if the selected_text is "" then
|
lns3.scpt
|
set the selected_text to the target_string
|
lns3.scpt
|
set the script_text to ""
|
lns3.scpt
|
set the script_text to the script_text & "with transaction" & CR
|
lns3.scpt
|
set the script_text to the script_text & tab & the selected_text & CR
|
lns3.scpt
|
set the script_text to the script_text & "end transaction"
|
lns3.scpt
|
set the replacement_string to "-- insert actions here"
|
lns3.scpt
|
if last character of selected_text is in {CR, NL} then
|
lns3.scpt
|
set the script_text to the script_text & tab & the selected_text
|
lns3.scpt
|
set the script_text to the script_text & "end transaction" & target_string & CR
|
lns3.scpt
|
set the replacement_string to ""
|
lns3.scpt
|
set contents of selection to script_text
|
lns3.scpt
|
check syntax
|
lns3.scpt
|
my replace_and_select(target_string, replacement_string)
|
lns3.scpt
|
on replace_and_select(target_string, replacement_string)
|
lns3.scpt
|
set this_text to the contents
|
lns3.scpt
|
set this_offset to the offset of the target_string in this_text
|
lns3.scpt
|
if this_offset is not 0 then
|
lns3.scpt
|
set selection to characters this_offset thru (this_offset + (length of the target_string) - 1)
|
lns3.scpt
|
set the contents of the selection to the replacement_string
|
lns3.scpt
|
end replace_and_select
|
lns3.scpt
|
display dialog "Enter the number of seconds before a timeout occurs:" default answer "180"
|
lns3.scpt
|
set the time_amount to the text returned of the result as integer
|
lns3.scpt
|
if the time_amount is greater than 0 then exit repeat
|
lns3.scpt
|
on error number error_number
|
lns3.scpt
|
if the error_number is -128 then return "user cancelled"
|
lns3.scpt
|
set the script_text to the script_text & "with timeout of " & (time_amount as string) & " seconds" & CR
|
lns3.scpt
|
set the script_text to the script_text & "end timeout"
|
lns3.scpt
|
set the script_text to the script_text & "end timeout" & target_string & CR
|
lns3.scpt
|
set the script_text to the script_text & "ignoring application responses" & CR
|
lns3.scpt
|
set the script_text to the script_text & "end ignoring"
|
lns3.scpt
|
set the script_text to the script_text & "end ignoring" & target_string & CR
|
lns3.scpt
|
set the script_text to the script_text & "If true then" & CR
|
lns3.scpt
|
set the script_text to the script_text & tab & target_string & CR
|
lns3.scpt
|
set the script_text to the script_text & "end if" & CR
|
lns3.scpt
|
set the script_text to the script_text & "If " & target_string & " then" & CR
|
lns3.scpt
|
set the replacement_string to "true"
|
lns3.scpt
|
set selection to {}
|
lns3.scpt
|
set the script_text to the script_text & "else" & CR & ¬
|
lns3.scpt
|
"-- insert else actions here" & CR & ¬
|
lns3.scpt
|
"end if" & CR
|
lns3.scpt
|
set the replacement_string to "-- insert if actions here"
|
lns3.scpt
|
set the script_text to the script_text & "else" & CR ¬
|
lns3.scpt
|
& target_string & CR ¬
|
lns3.scpt
|
& "end if" & CR --& target_string
|
lns3.scpt
|
set the replacement_string to "-- insert else actions here"
|
lns3.scpt
|
set the script_text to the script_text & "If true then" & CR & ¬
|
lns3.scpt
|
"-- insert if actions here" & CR & ¬
|
lns3.scpt
|
"else" & CR
|
lns3.scpt
|
set the script_text to the script_text & target_string & CR & ¬
|
lns3.scpt
|
set the script_text to the script_text & "end if" & CR --& target_string
|
lns3.scpt
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.