Created
May 31, 2013 20:28
-
-
Save anonymous/5687755 to your computer and use it in GitHub Desktop.
Script that pulls URLs from a page in Safari and writes to a text file on the Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get the text from Safari | |
tell application "Safari" | |
set thePageText to text of document 1 | |
end tell | |
-- Split the text into paragraphs | |
set thePars to paragraphs of thePageText | |
-- Find all paragraphs matching the desired criteria | |
set theText to "" | |
repeat with aPar in thePars | |
if aPar contains "www.myrepospace.com/profile" then | |
set theText to theText & (aPar & return as string) | |
end if | |
end repeat | |
-- Write the paragraphs to a file on the Desktop | |
set theOutputFile to (path to desktop folder as string) & "Results.txt" | |
try | |
set theOutputFile to open for access theOutputFile with write permission | |
write theText to theOutputFile starting at eof | |
close access theOutputFile | |
on error | |
close access theOutputFile | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment