text
stringlengths
0
15.7k
source
stringlengths
6
112
on Download(thisUrl, localFile)
gistfile1 copy 3.scpt
do shell script "curl -s -L " & thisUrl & " -o '" & POSIX path of localFile & "'"
gistfile1 copy 3.scpt
end Download
gistfile1 copy 3.scpt
set myFolder to (path to library folder from user domain as string) & "Application Support:Movie Barcoder:"
gistfile1 copy 3.scpt
set f to myFolder & "moviebarcode-index"
gistfile1 copy 3.scpt
if not (exists myFolder) then
gistfile1 copy 3.scpt
make new folder at (path to library folder from user domain as string) & "Application Support:" with properties {name:"Movie Barcoder"}
gistfile1 copy 3.scpt
if exists f then
gistfile1 copy 3.scpt
if (current date) - (modification date of file f) > 48 * 60 * 60 then
gistfile1 copy 3.scpt
delete f
gistfile1 copy 3.scpt
if not (exists f) then
gistfile1 copy 3.scpt
my Download("http://moviebarcode.tumblr.com/movie-index", f)
gistfile1 copy 3.scpt
set cmdString to "grep -oE '(http:\\/\\/moviebarcode.tumblr.com[^\\\"]*)\\\">([^<]*)' \"" & (POSIX path of f) & "\" | sed -nE \"s/&amp;/\\&/g;s/([^\\\"]+)\\\">(.*) \\(([0-9]+)\\)/\\2|\\3|\\1/p\""
gistfile1 copy 3.scpt
set cmdResult to do shell script cmdString
gistfile1 copy 3.scpt
set movieItems to paragraphs of cmdResult
gistfile1 copy 3.scpt
set idx to random number from 1 to length of movieItems
gistfile1 copy 3.scpt
set movieInfo to item idx of movieItems
gistfile1 copy 3.scpt
set AppleScript's text item delimiters to "|"
gistfile1 copy 3.scpt
set movieItems to every text item of movieInfo
gistfile1 copy 3.scpt
set basePath to myFolder & "movie-data" & idx
gistfile1 copy 3.scpt
set html to basePath & ".html"
gistfile1 copy 3.scpt
set jpg to basePath & ".jpg"
gistfile1 copy 3.scpt
set movieName to text item 1 of movieItems
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "\\", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, ":", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "|", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "?", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "%", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "*", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "\"", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "<", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, ">", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, "/", "")
gistfile1 copy 3.scpt
set movieName to my replaceString(movieName, ".", "")
gistfile1 copy 3.scpt
set finalHtml to myFolder & movieName & ".html"
gistfile1 copy 3.scpt
set finalImg to myFolder & movieName & ".jpg"
gistfile1 copy 3.scpt
if not (exists finalHtml) then
gistfile1 copy 3.scpt
my Download(text item 3 of movieItems, html)
gistfile1 copy 3.scpt
set name of file html to (movieName & ".html")
gistfile1 copy 3.scpt
if exists finalHtml then
gistfile1 copy 3.scpt
if not (exists finalImg) then
gistfile1 copy 3.scpt
set cmdString to "grep -oE '<img src=\"http://[0-9]*.media.tumblr.com/[^\"]*' \"" & (POSIX path of finalHtml) & "\" | head -n 1 | grep -oE 'http://[0-9]*.media.tumblr.com/[^\"]*'"
gistfile1 copy 3.scpt
set imageFile to do shell script cmdString
gistfile1 copy 3.scpt
my Download(imageFile, jpg)
gistfile1 copy 3.scpt
set name of file jpg to (movieName & ".jpg")
gistfile1 copy 3.scpt
if exists finalImg then
gistfile1 copy 3.scpt
tell application "System Events" to set picture of desktop 1 to (finalImg as alias)
gistfile1 copy 3.scpt
my GrowlNotify((text item 1 of movieItems) & " (" & (text item 2 of movieItems) & ")")
gistfile1 copy 3.scpt
my GrowlNotify("Failed to create image file.")
gistfile1 copy 3.scpt
tell application "Finder"
Script 5-10.applescript
every file of entire contents of folder "Documents" of home whose size > (10 * 1000 * 1000)
Script 5-10.applescript
set _path to (path of temporary items folder) as string
Temporary Items.applescript
tell application "System Events" to tell process "Safari"
allow-apple-events-in-safari.applescript
set allowJavaScriptMenu to menu item "Allow JavaScript from Apple Events" of menu 1 of menu bar item "Develop" of menu bar 1
allow-apple-events-in-safari.applescript
if value of attribute "AXMenuItemMarkChar" of allowJavaScriptMenu is missing value then
allow-apple-events-in-safari.applescript
click allowJavaScriptMenu
allow-apple-events-in-safari.applescript
name of processes
01-system-event.applescript
set libfiles to used script library files
Open-Used-Script-Libraries.applescript
repeat with f in libfiles
Open-Used-Script-Libraries.applescript
open f
Open-Used-Script-Libraries.applescript
set userPath to ("Macintosh HD:") as string
applescript-ipasigner.applescript
set userPathEnc to userPath
applescript-ipasigner.applescript
set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
applescript-ipasigner.applescript
set temp to text items of userPathEnc
applescript-ipasigner.applescript
set userPathEnc to temp as text
applescript-ipasigner.applescript
set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "Macintosh HD"}
applescript-ipasigner.applescript
set provPath to ("~/Desktop/profile.mobileprovision") as string
applescript-ipasigner.applescript
set provPathEnc to provPath
applescript-ipasigner.applescript
set temp to text items of provPathEnc
applescript-ipasigner.applescript
set provPathEnc to temp as text
applescript-ipasigner.applescript
set folderPath to ((path to desktop folder)) as string
applescript-ipasigner.applescript
set folderPathEnc to folderPath
applescript-ipasigner.applescript
set temp to text items of folderPathEnc
applescript-ipasigner.applescript
set folderPathEnc to temp as text
applescript-ipasigner.applescript
display dialog "AppleScript IPA Signer" buttons {"Quit", "About", "Continue"} default button 3
applescript-ipasigner.applescript
if the button returned of the result is "Quit" then
applescript-ipasigner.applescript
else if the button returned of the result is "About" then
applescript-ipasigner.applescript
display dialog "AppleScript IPA Signer written by Leon M'laiel (@Cynostial) 2017 - Licensed via MIT, do not remove Copyright Notice" & return & "All Rights Reserved" buttons {"That's awesome!"} default button 1
applescript-ipasigner.applescript
else if the button returned of the result is "Continue" then
applescript-ipasigner.applescript
set pathChal to display dialog "Set IPA Path:" default answer folderPathEnc buttons {"Continue"} default button 1
applescript-ipasigner.applescript
set folderPathEnc to text returned of pathChal
applescript-ipasigner.applescript
set folderPath to folderPathEnc
applescript-ipasigner.applescript
set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
applescript-ipasigner.applescript
set temp to text items of folderPath
applescript-ipasigner.applescript
set folderPath to temp as text
applescript-ipasigner.applescript
set folderPathNoHD to folderPathEnc
applescript-ipasigner.applescript
set temp to text items of folderPathNoHD
applescript-ipasigner.applescript
set folderPathNoHD to temp as text
applescript-ipasigner.applescript
set fileList to paragraphs of (do shell script "ls " & folderPathNoHD & "*ipa")
applescript-ipasigner.applescript
display dialog "Sign all files or one only?" buttons {"Single File", "All Files"} default button 2
applescript-ipasigner.applescript
if the button returned of the result is "Single File" then
applescript-ipasigner.applescript
set pwdAlias to insertion location as alias
Select Grep.applescript
if not (exists folder pwdAlias) then
Select Grep.applescript
set pwdAlias to (container of pwdAlias) as alias
Select Grep.applescript
set pwd to POSIX path of pwdAlias
Select Grep.applescript
set dr to display dialog "Grep pattern:" default answer "" buttons {"Cancel", "Add Matches", "Select Matches"} default button 3 cancel button 1 with title pwd giving up after 60
Select Grep.applescript
if button returned of dr is equal to "" then
Select Grep.applescript
else if button returned of dr is equal to "Select Matches" then
Select Grep.applescript
if selection as alias is not equal to pwdAlias then select {}
Select Grep.applescript
select {}
Select Grep.applescript