text
stringlengths
0
15.7k
source
stringlengths
6
112
padWithPrefix("Hello
padWithPrefix.applescript
World
padWithPrefix.applescript
This
padWithPrefix.applescript
is
padWithPrefix.applescript
test", 30, " ")
padWithPrefix.applescript
on padWithPrefix(aText, newWidth, aPrefix)
padWithPrefix.applescript
set end of newParagraphs to padWithPrefix(paragraph i of aText, newWidth, aPrefix)
padWithPrefix.applescript
set aText to aPrefix & aText
padWithPrefix.applescript
end padWithPrefix
padWithPrefix.applescript
set mdURL to "[" & name of i & "|" & URL of i & "]"
Current URL to clipboard jira copy.scpt
set yesno to {"yes", "no"}
focus.applescript
choose from list yesno with title "Focus" with prompt "Want to focus?" default items (get item 1 in yesno)
focus.applescript
set chosen to result
focus.applescript
if chosen is false then
focus.applescript
set hostsFile to "/etc/hosts"
focus.applescript
set theContent to read hostsFile as «class utf8»
focus.applescript
set theOffset to (offset of "######## focus" in theContent) - 1
focus.applescript
set coreContent to ""
focus.applescript
if theOffset is -1 then
focus.applescript
set coreContent to theContent
focus.applescript
set coreContent to text 1 thru (theOffset) of theContent
focus.applescript
set dangerous to "######## focus
focus.applescript
127.0.0.1 www.facebook.com
focus.applescript
127.0.0.1 facebook.com
focus.applescript
127.0.0.1 www.youtube.com
focus.applescript
127.0.0.1 youtube.com
focus.applescript
127.0.0.1 inbox.google.com"
focus.applescript
set newContent to ""
focus.applescript
if chosen as string is equal to "yes" then
focus.applescript
set newContent to coreContent & dangerous
focus.applescript
set newContent to coreContent
focus.applescript
do shell script "echo '" & newContent & "' > " & hostsFile with administrator privileges
focus.applescript
property name_prefix : ""
file-renamer.applescript
property name_suffix : ""
file-renamer.applescript
property file_ext : "svg"
file-renamer.applescript
property new_folder_name : "000-renamed"
file-renamer.applescript
property find_and_replace : {to_find:{"line-"}, to_replace:{""}}
file-renamer.applescript
set source_folder to choose folder with prompt "Choose a folder of files to rename" as string
file-renamer.applescript
my do_main_script(source_folder)
file-renamer.applescript
on do_main_script(source_folder)
file-renamer.applescript
tell application "Finder" to set source_folder to folder (source_folder)
file-renamer.applescript
tell application "Finder" to set target_folder to source_folder
file-renamer.applescript
if source_folder is not "" and target_folder is not "" then
file-renamer.applescript
set svg_list to every file of source_folder whose name extension is file_ext
file-renamer.applescript
my create_new_folder(target_folder, new_folder_name)
file-renamer.applescript
set posix_target_folder to quoted form of POSIX path of ((target_folder as string) & new_folder_name as string)
file-renamer.applescript
log "posix_target_folder: " & posix_target_folder
file-renamer.applescript
repeat with svg_file in svg_list
file-renamer.applescript
set posix_src_file to quoted form of POSIX path of (svg_file as string)
file-renamer.applescript
set svg_name to (name of svg_file as string)
file-renamer.applescript
set new_name to my strip_prefix(svg_name)
file-renamer.applescript
repeat with n from 1 to count of (to_find of find_and_replace)
file-renamer.applescript
set new_name to my str_replace(item n of to_find of find_and_replace, item n of to_replace of find_and_replace, new_name)
file-renamer.applescript
set new_name to name_prefix & my str_replace("." & file_ext as string, name_suffix, new_name) & "." & file_ext as string
file-renamer.applescript
set new_name to my change_case(new_name, 0)
file-renamer.applescript
set posix_new_file to quoted form of POSIX path of ((target_folder as string) & new_name as string)
file-renamer.applescript
set target_file_path to ((target_folder as string) & new_folder_name as string)
file-renamer.applescript
if not (exists target_file_path & ":" & svg_name) and not (exists target_file_path & ":" & new_name) then
file-renamer.applescript
set new_file to duplicate svg_file to target_file_path
file-renamer.applescript
set new_file to alias (target_file_path & ":" & svg_name)
file-renamer.applescript
if not (exists target_file_path & ":" & new_name) then
file-renamer.applescript
set name of new_file to new_name
file-renamer.applescript
on error rename_err_str
file-renamer.applescript
log "Error renaming new file: " & rename_err_str
file-renamer.applescript
log errstr
file-renamer.applescript
end do_main_script
file-renamer.applescript
on strip_prefix(the_string)
file-renamer.applescript
set prev_tids to text item delimiters of AppleScript
file-renamer.applescript
set text_items to text items of the_string
file-renamer.applescript
set new_string to text items 2 thru -1 of text_items
file-renamer.applescript
return new_string
file-renamer.applescript
set text item delimiters of AppleScript to prev_tids
file-renamer.applescript
end strip_prefix
file-renamer.applescript
on create_new_folder(target_folder, new_folder_name)
file-renamer.applescript
set new_folder to make new folder at target_folder with properties {name:new_folder_name}
file-renamer.applescript
return new_folder
file-renamer.applescript
end create_new_folder
file-renamer.applescript
on str_replace(find, replace, subject)
file-renamer.applescript
set returnList to true
file-renamer.applescript
if class of find is not list and class of replace is list then return subject
file-renamer.applescript
if class of find is not list then set find to {find}
file-renamer.applescript
if class of subject is not list then ¬
file-renamer.applescript
set {subject, returnList} to {{subject}, false}
file-renamer.applescript
set findCount to count find
file-renamer.applescript
set usingReplaceList to class of replace is list
file-renamer.applescript
repeat with i from 1 to (count subject)
file-renamer.applescript
set thisSubject to item i of subject
file-renamer.applescript
repeat with n from 1 to findCount
file-renamer.applescript
set text item delimiters of AppleScript to item n of find
file-renamer.applescript
set thisSubject to text items of thisSubject
file-renamer.applescript
if usingReplaceList then
file-renamer.applescript
item n of replace
file-renamer.applescript
on error err_str
file-renamer.applescript
log err_str
file-renamer.applescript
replace
file-renamer.applescript
set text item delimiters of AppleScript to result
file-renamer.applescript
set thisSubject to "" & thisSubject
file-renamer.applescript
set item i of subject to thisSubject
file-renamer.applescript
if not returnList then return beginning of subject
file-renamer.applescript
end str_replace
file-renamer.applescript