Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* What to do before starting this script:
- * Open Safari
- * Open Atom in fullscreen, make sure it's empty
- * Disable Regrex in Atom *)
- -- OPTIONS
- set shutdown to false -- Do you want your Mac to shut down after importing?
- set savedialog to true -- Choose if you want to display a dialog asking you to save each chapter. For longer books I found that helpful to be able to exit out. It has a timeout of 5 seconds if you don't bother picking an option.
- set bigdialog to false -- Choose to abort after each imported book
- set dialogchosen to false -- Choose if you want a display showing you the books you're about to import
- set translation to "ESV" -- pick your translation
- -- BOOKS
- -- Pick the books you want to import!
- set pickGen to false -- Choose Genesis
- set pickExod to false -- Choose Exodus
- set pickLev to false -- Choose Leviticus
- set pickNum to false -- Choose Numbers
- set pickDeut to false -- Choose Deuteronomy
- set pickJosh to false -- Choose Joshua
- set pickJudg to false -- Choose Judges
- set pickRuth to false -- Choose Ruth
- set pickoneSam to false -- Choose 1 Samuel
- set picktwoSam to false -- Choose 2 Samuel
- set pickoneKings to true -- Choose 1 Kings
- set picktwoKings to true -- Choose 2 Kings
- set pickoneChron to true -- Choose 1 Chronicles
- set picktwoChron to true -- Choose 2 Chronicles
- set pickEzr to false -- Choose Ezra
- set pickNeh to false -- Choose Nehemiah
- set pickEsth to false -- Choose Esther
- set pickJob to false -- Choose Job
- set pickPs to false -- Choose Psalm
- set pickProv to false -- Choose Proverbs
- set pickEccles to false -- Choose Ecclesiastes
- set pickSong to true -- Choose Song of Solomon
- set pickIsa to false -- Choose Isaiah
- set pickJer to false -- Choose Jeremiah
- set pickLam to false -- Choose Lamentations
- set pickEzek to false -- Choose Ezekiel
- set pickDan to false -- Choose Daniel
- set pickHos to false -- Choose Hosea
- set pickJoel to false -- Choose Joel
- set pickAm to false -- Choose Amos
- set pickObad to false -- Choose Obadiah
- set pickJonah to false -- Choose Jonah
- set pickMicah to false -- Choose Micah
- set pickNah to false -- Choose Nahum
- set pickHab to false -- Choose Habakkuk
- set pickZeph to false -- Choose Zephaniah
- set pickHag to false -- Choose Haggai
- set pickZech to false -- Choose Zechariah
- set pickMal to false -- Choose Malachi
- set pickMatt to false -- Choose Matthew
- set pickMark to false -- Choose Mark
- set pickLuke to false -- Choose Luke
- set pickJohn to false -- Choose John
- set pickActs to false -- Choose Acts
- set pickRom to false -- Choose Romans
- set pickoneCor to true -- Choose 1 Corinthians
- set picktwoCor to true -- Choose 2 Corinthians
- set pickGal to false -- Choose Galatians
- set pickEphes to false -- Choose Ephesians
- set pickPhil to false -- Choose Philippians
- set pickCol to false -- Choose Colossians
- set pickoneThess to true -- Choose 1 Thessalonians
- set picktwoThess to true -- Choose 2 Thessalonians
- set pickoneTim to true -- Choose 1 Timothy
- set picktwoTim to true -- Choose 2 Timothy
- set pickTitus to true -- Choose Titus
- set pickPhilem to true -- Choose Philemon
- set pickHeb to true -- Choose Hebrews
- set pickJames to true -- Choose James
- set pickonePet to true -- Choose 1 Peter
- set picktwoPet to true -- Choose 2 Peter
- set pickoneJohn to true -- Choose 1 John
- set picktwoJohn to true -- Choose 2 John
- set pickthreeJohn to true -- Choose 3 John
- set pickJude to true -- Choose Jude
- set pickRev to true -- Choose Revelation
- -- VARIABLES
- set bookchosen to {}
- -- DATA
- -- # Mouse Coordinates, find those with Shift + Command + 4
- -- The text field in Atom
- set textX to 53
- set textY to 86
- -- Regrex in atom
- set regX to 1121
- set regY to 674
- -- Pick standard folder to save in
- set folderX to 290
- set folderY to 201
- -- Choose "New Folder"
- set newX to 285
- set newY to 470
- -- DELAYS
- -- Set those according to your computing power and internet connection
- set DelayStart to 4
- set DelayLong to 4
- set DelayMed to 0.8
- set DelayShort to 0.4
- -- Book information (Position, name, abbreviation, amount chapters)
- set Genlist to {"01", "Genesis", "Gen", 50}
- set Exodlist to {"02", "Exodus", "Exod", 40}
- set Levlist to {"03", "Leviticus", "Lev", 27}
- set Numlist to {"04", "Numbers", "Num", 36}
- set Deutlist to {"05", "Deuteronomy", "Deut", 34}
- set Joshlist to {"06", "Joshua", "Josh", 24}
- set Judglist to {"07", "Judges", "Judg", 21}
- set Ruthlist to {"08", "Ruth", "Ruth", 41}
- set oneSamlist to {"09", "1%20Samuel", "1 Sam", 31}
- set twoSamlist to {"10", "2%20Samuel", "2 Sam", 24}
- set oneKingslist to {"11", "1%20Kings", "1 Kings", 22}
- set twoKingslist to {"12", "2%20Kings", "2 Kings", 25}
- set oneChronlist to {"13", "1%20Chronicles", "1 Chron", 29}
- set twoChronlist to {"14", "2%20Chronicles", "2 Chron", 36}
- set Ezrlist to {"15", "Ezra", "Ezr", 10}
- set Nehlist to {"16", "Nehemiah", "Neh", 13}
- set Esthlist to {"17", "Esther", "Esth", 10}
- set Joblist to {"18", "Job", "Job", 42}
- set Pslist to {"19", "Psalm", "Ps", 150}
- set Provlist to {"20", "Proverbs", "Prov", 31}
- set Eccleslist to {"21", "Ecclesiastes", "Eccles", 12}
- set Songlist to {"22", "Song%20of%20Solomon", "Song", 8}
- set Isalist to {"23", "Isaiah", "Isa", 66}
- set Jerlist to {"24", "Jeremiah", "Jer", 52}
- set Lamlist to {"25", "Lamentations", "Lam", 5}
- set Ezeklist to {"26", "Ezekiel", "Ezek", 48}
- set Danlist to {"27", "Daniel", "Dan", 12}
- set Hoslist to {"28", "Hosea", "Hos", 14}
- set Joellist to {"29", "Joel", "Joel", 3}
- set Amlist to {"30", "Amos", "Am", 9}
- set Obadlist to {"31", "Obadiah", "Obad", 1}
- set Jonahlist to {"32", "Jonah", "Jonah", 4}
- set Micahlist to {"33", "Micah", "Micah", 7}
- set Nahlist to {"34", "Nahum", "Nah", 3}
- set Hablist to {"35", "Habakkuk", "Hab", 3}
- set Zephlist to {"36", "Zephaniah", "Zeph", 3}
- set Haglist to {"37", "Haggai", "Hag", 2}
- set Zechlist to {"38", "Zechariah", "Zech", 14}
- set Mallist to {"39", "Malachi", "Mal", 4}
- set Mattlist to {"40", "Matthew", "Matt", 28}
- set Marklist to {"41", "Mark", "Mark", 16}
- set Lukelist to {"42", "Luke", "Luke", 24}
- set Johnlist to {"43", "John", "John", 21}
- set Actslist to {"44", "Acts", "Acts", 28}
- set Romlist to {"45", "Romans", "Rom", 16}
- set oneCorlist to {"46", "1%20Corinthians", "1 Cor", 16}
- set twoCorlist to {"47", "2%20Corinthians", "2 Cor", 13}
- set Gallist to {"48", "Galatians", "Gal", 6}
- set Epheslist to {"49", "Ephesians", "Ephes", 6}
- set Phillist to {"50", "Philippians", "Phil", 4}
- set Collist to {"51", "Colossians", "Col", 4}
- set oneThesslist to {"52", "1%20Thessalonians", "1 Thess", 5}
- set twoThesslist to {"53", "1%20Thessalonians", "2 Thess", 3}
- set oneTimlist to {"54", "1%20Timothy", "1 Tim", 6}
- set twoTimlist to {"55", "2%20Timothy", "2 Tim", 4}
- set Tituslist to {"56", "Titus", "Titus", 3}
- set Philemlist to {"57", "Philemon", "Philem", 1}
- set Heblist to {"58", "Hebrews", "Heb", 13}
- set Jameslist to {"59", "James", "James", 5}
- set onePetlist to {"60", "1%20Peter", "1 Pet", 5}
- set twoPetlist to {"61", "2%20Peter", "2 Pet", 3}
- set oneJohnlist to {"62", "1%20John", "1 John", 5}
- set twoJohnlist to {"63", "2%20John", "2 John", 1}
- set threeJohnlist to {"64", "3%20John", "3 John", 1}
- set Judelist to {"65", "Jude", "Jude", 1}
- set Revlist to {"66", "Revelation", "Rev", 22}
- -- Log which books were chosen
- if pickGen is true then
- set bookchosen to bookchosen & Genlist
- end if
- if pickExod is true then
- set bookchosen to bookchosen & Exodlist
- end if
- if pickLev is true then
- set bookchosen to bookchosen & Levlist
- end if
- if pickNum is true then
- set bookchosen to bookchosen & Numlist
- end if
- if pickDeut is true then
- set bookchosen to bookchosen & Deutlist
- end if
- if pickJosh is true then
- set bookchosen to bookchosen & Joshlist
- end if
- if pickJudg is true then
- set bookchosen to bookchosen & Judglist
- end if
- if pickRuth is true then
- set bookchosen to bookchosen & Ruthlist
- end if
- if pickoneSam is true then
- set bookchosen to bookchosen & oneSamlist
- end if
- if picktwoSam is true then
- set bookchosen to bookchosen & twoSamlist
- end if
- if pickoneKings is true then
- set bookchosen to bookchosen & oneKingslist
- end if
- if picktwoKings is true then
- set bookchosen to bookchosen & twoKingslist
- end if
- if pickoneChron is true then
- set bookchosen to bookchosen & oneChronlist
- end if
- if picktwoChron is true then
- set bookchosen to bookchosen & twoChronlist
- end if
- if pickEzr is true then
- set bookchosen to bookchosen & Ezrlist
- end if
- if pickNeh is true then
- set bookchosen to bookchosen & Nehlist
- end if
- if pickEsth is true then
- set bookchosen to bookchosen & Esthlist
- end if
- if pickJob is true then
- set bookchosen to bookchosen & Joblist
- end if
- if pickPs is true then
- set bookchosen to bookchosen & Pslist
- end if
- if pickProv is true then
- set bookchosen to bookchosen & Provlist
- end if
- if pickEccles is true then
- set bookchosen to bookchosen & Eccleslist
- end if
- if pickSong is true then
- set bookchosen to bookchosen & Songlist
- end if
- if pickIsa is true then
- set bookchosen to bookchosen & Isalist
- end if
- if pickJer is true then
- set bookchosen to bookchosen & Jerlist
- end if
- if pickLam is true then
- set bookchosen to bookchosen & Lamlist
- end if
- if pickEzek is true then
- set bookchosen to bookchosen & Ezeklist
- end if
- if pickDan is true then
- set bookchosen to bookchosen & Danlist
- end if
- if pickHos is true then
- set bookchosen to bookchosen & Hoslist
- end if
- if pickJoel is true then
- set bookchosen to bookchosen & Joellist
- end if
- if pickAm is true then
- set bookchosen to bookchosen & Amlist
- end if
- if pickObad is true then
- set bookchosen to bookchosen & Obadlist
- end if
- if pickJonah is true then
- set bookchosen to bookchosen & Jonahlist
- end if
- if pickMicah is true then
- set bookchosen to bookchosen & Micahlist
- end if
- if pickNah is true then
- set bookchosen to bookchosen & Nahlist
- end if
- if pickHab is true then
- set bookchosen to bookchosen & Hablist
- end if
- if pickZeph is true then
- set bookchosen to bookchosen & Zephlist
- end if
- if pickHag is true then
- set bookchosen to bookchosen & Haglist
- end if
- if pickZech is true then
- set bookchosen to bookchosen & Zechlist
- end if
- if pickMal is true then
- set bookchosen to bookchosen & Mallist
- end if
- if pickMatt is true then
- set bookchosen to bookchosen & Mattlist
- end if
- if pickMark is true then
- set bookchosen to bookchosen & Marklist
- end if
- if pickLuke is true then
- set bookchosen to bookchosen & Lukelist
- end if
- if pickJohn is true then
- set bookchosen to bookchosen & Johnlist
- end if
- if pickActs is true then
- set bookchosen to bookchosen & Actslist
- end if
- if pickRom is true then
- set bookchosen to bookchosen & Romlist
- end if
- if pickoneCor is true then
- set bookchosen to bookchosen & oneCorlist
- end if
- if picktwoCor is true then
- set bookchosen to bookchosen & twoCorlist
- end if
- if pickGal is true then
- set bookchosen to bookchosen & Gallist
- end if
- if pickEphes is true then
- set bookchosen to bookchosen & Epheslist
- end if
- if pickPhil is true then
- set bookchosen to bookchosen & Phillist
- end if
- if pickCol is true then
- set bookchosen to bookchosen & Collist
- end if
- if pickoneThess is true then
- set bookchosen to bookchosen & oneThesslist
- end if
- if picktwoThess is true then
- set bookchosen to bookchosen & twoThesslist
- end if
- if pickoneTim is true then
- set bookchosen to bookchosen & oneTimlist
- end if
- if picktwoTim is true then
- set bookchosen to bookchosen & twoTimlist
- end if
- if pickTitus is true then
- set bookchosen to bookchosen & Tituslist
- end if
- if pickPhilem is true then
- set bookchosen to bookchosen & Philemlist
- end if
- if pickHeb is true then
- set bookchosen to bookchosen & Heblist
- end if
- if pickJames is true then
- set bookchosen to bookchosen & Jameslist
- end if
- if pickonePet is true then
- set bookchosen to bookchosen & onePetlist
- end if
- if picktwoPet is true then
- set bookchosen to bookchosen & twoPetlist
- end if
- if pickoneJohn is true then
- set bookchosen to bookchosen & oneJohnlist
- end if
- if picktwoJohn is true then
- set bookchosen to bookchosen & twoJohnlist
- end if
- if pickthreeJohn is true then
- set bookchosen to bookchosen & threeJohnlist
- end if
- if pickJude is true then
- set bookchosen to bookchosen & Judelist
- end if
- if pickRev is true then
- set bookchosen to bookchosen & Revlist
- end if
- set totallength to length of bookchosen
- set bookamount to (totallength / 4)
- set chapter to 1
- if bookchosen is {} then
- set dialogRes3 to display dialog "You have not chosen any books to import." with icon caution buttons {"Okay"} default button "Okay"
- if the button returned of dialogRes3 is "Okay" then
- error number -128
- end if
- end if
- set posid to 1
- set bookid to 2
- set abbid to 3
- set maxchapid to 4
- set posbible to (item posid) of bookchosen
- set book to (item bookid) of bookchosen
- set abb to (item abbid) of bookchosen
- set maxchapter to (item maxchapid) of bookchosen
- set dialogbooks to {}
- set multiplier to 2
- repeat bookamount times
- set dialogbooks to dialogbooks & (item multiplier of bookchosen)
- set multiplier to multiplier + 4
- end repeat
- if dialogchosen is true then
- set dialogRes2 to display dialog "You have chosen these books to import: " & dialogbooks with icon caution buttons {"Exit", "Proceed"} default button "Proceed"
- if the button returned of dialogRes2 is "Exit" then
- error number -128
- end if
- end if
- repeat bookamount times
- -- Jumping to a new book
- if chapter > maxchapter then
- set posid to (posid + 4)
- set bookid to (bookid + 4)
- set abbid to (abbid + 4)
- set maxchapid to (maxchapid + 4)
- set posbible to (item posid) of bookchosen
- set book to (item bookid) of bookchosen
- set abb to (item abbid) of bookchosen
- set maxchapter to (item maxchapid) of bookchosen
- set chapter to 1
- end if
- repeat maxchapter times
- -- COPYING FROM SAFARI
- -- Open Link
- tell application "Safari"
- activate
- delay DelayMed
- tell window 1
- set current tab to (make new tab with properties {URL:"https://www.biblegateway.com/passage/?search=" & book & "%20" & chapter & "&version=" & translation & "&interface=print"})
- end tell
- end tell
- delay DelayLong
- -- Copy all
- tell application "System Events"
- keystroke "a" using command down
- delay DelayShort
- keystroke "c" using command down
- end tell
- delay DelayShort
- tell application "Safari"
- activate
- tell window 1
- close current tab
- end tell
- end tell
- -- ACTIVATE ATOM
- tell application "Atom"
- activate
- end tell
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & textX & "," & textY
- delay DelayMed
- tell application "System Events"
- delay DelayShort
- keystroke "v" using command down
- delay DelayShort
- keystroke "f" using command down
- keystroke book & " " & chapter
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- key code 36 using command down
- -- Delete Version name
- keystroke "f" using command down
- keystroke "English Standard Version"
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- key code 36 using command down
- -- Delete Bottom
- -- #1
- keystroke "f" using command down
- keystroke " (ESV)"
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- key code 36 using command down
- -- #2
- keystroke "f" using command down
- keystroke "The Holy Bible, . ESV® Text Edition: 2016. Copyright © 2001 by Crossway Bibles, a publishing ministry of Good News Publishers."
- delay DelayShort
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- delay DelayMed
- key code 36 using command down
- -- #3
- keystroke "f" using command down
- keystroke "Twitter"
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- key code 36 using command down
- -- #4
- keystroke "f" using command down
- keystroke "Facebook"
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- key code 36 using command down
- -- #5
- keystroke "f" using command down
- keystroke "Email"
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- key code 36 using command down
- -- FIX FIRST NUMBER
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & textX & "," & textY
- delay DelayShort
- key code 126 using command down --top of page
- delay DelayShort
- repeat 3 times
- key code 125 using shift down -- delete top lines
- end repeat
- key code 51 --delete
- key code 124 --move right
- delay DelayShort
- key code 51 -- delete
- if chapter > 9 then
- delay DelayShort
- key code 124 --move right
- delay DelayShort
- key code 51 -- delete
- end if
- if chapter > 99 then
- delay DelayShort
- key code 124 --move right
- delay DelayShort
- key code 51 -- delete
- end if
- delay DelayShort
- keystroke "1"
- -- START SEARCH
- delay DelayMed
- keystroke "f" using command down
- delay DelayMed
- -- Enable Regrex
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & regX & "," & regY
- delay DelayShort
- keystroke "f" using command down
- delay DelayShort
- -- ENTER REGREX CODE
- keystroke "([0-9]|[1-9][0-9]|100)"
- key code "26" using {shift down, option down} -- write "\"
- keystroke "s"
- delay DelayMed
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- delay DelayShort
- key code "26" using {shift down, option down} -- write "\"
- keystroke "n "
- key code "26" using {shift down, option down} -- write "\"
- keystroke "n###### " & "v$1 "
- key code "26" using {shift down, option down} -- write "\"
- keystroke "n"
- delay DelayMed
- -- FORMAT USING REGREX
- key code 36 using command down
- -- DELETE DOUBLE LINES
- delay DelayMed
- keystroke "f" using command down
- delay DelayShort
- key code 51 -- delete
- delay DelayShort
- key code "26" using {shift down, option down} -- write "\"
- keystroke "n*"
- key code "26" using {shift down, option down} -- write "\"
- keystroke "n"
- delay DelayShort
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- delay DelayShort
- key code "26" using {shift down, option down} -- write "\"
- keystroke "n"
- delay DelayMed
- key code 36 using command down
- -- ENTER CHAPTER NAVIGATION TOP
- delay DelayShort
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & textX & "," & textY
- delay DelayMed
- key code 126 using command down --top of page
- delay DelayShort
- keystroke "# " & book & " " & chapter
- key code "36"
- key code "36"
- delay DelayShort
- if (chapter - 1) > 0 then
- if 9 > (chapter - 1) then
- keystroke "[[" & abb & "-" & "0" & (chapter - 1) & "|<- " & book & " " & "0" & (chapter - 1) & " ]] | "
- else
- keystroke "[[" & abb & "-" & (chapter - 1) & "|<- " & book & " " & (chapter - 1) & " ]] | "
- end if
- end if
- keystroke "[[_" & book & "|" & book & "]]"
- if maxchapter > (chapter) then
- if 9 > (chapter + 1) then
- keystroke " | [[" & abb & "-" & "0" & (chapter + 1) & "|" & book & " " & "0" & (chapter + 1) & " ->]]"
- else
- keystroke " | [[" & abb & "-" & (chapter + 1) & "|" & book & " " & (chapter + 1) & " ->]]"
- end if
- end if
- key code "36"
- keystroke "***"
- -- ENTER NAVIGATION BOTTOM
- key code 125 using command down --bottom of page
- delay DelayShort
- key code "36"
- keystroke "***"
- key code "36"
- if (chapter - 1) > 0 then
- if 9 > (chapter - 1) then
- keystroke "[[" & abb & "-" & "0" & (chapter - 1) & "|<- " & book & " " & "0" & (chapter - 1) & " ]] | "
- else
- keystroke "[[" & abb & "-" & (chapter - 1) & "|<- " & book & " " & (chapter - 1) & " ]] | "
- end if
- end if
- keystroke "[[_" & book & "|" & book & "]]"
- if maxchapter > (chapter) then
- if 9 > (chapter + 1) then
- keystroke " | [[" & abb & "-" & "0" & (chapter + 1) & "|" & book & " " & "0" & (chapter + 1) & " ->]]"
- else
- keystroke " | [[" & abb & "-" & (chapter + 1) & "|" & book & " " & (chapter + 1) & " ->]]"
- end if
- end if
- -- Disable Regrex
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & regX & "," & regY
- -- Delete Encoding
- if book contains "%20" then
- keystroke "f" using command down
- delay DelayShort
- key code 51 -- delete
- delay DelayShort
- keystroke "%20"
- delay DelayShort
- key code 48 -- tab
- delay DelayShort
- keystroke "a" using command down
- key code 51 -- delete
- delay DelayShort
- keystroke " "
- delay DelayMed
- key code 36 using command down
- end if
- -- SAVING DIALOG
- if savedialog is true then
- set dialogResult to display dialog "Do you want to save this chapter?" with icon caution buttons {"Exit", "Save"} default button "Save" giving up after 3
- if the button returned of dialogResult is "Exit" then
- error number -128
- end if
- end if
- -- CLICK INTO TEXT FIELD
- delay DelayMed
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & textX & "," & textY
- delay DelayShort
- -- SAVE
- delay DelayMed
- keystroke "s" using {shift down, command down}
- delay DelayMed
- -- Choose top folder
- if chapter = 1 then
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & folderX & "," & folderY
- delay DelayMed
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & newX & "," & newY
- delay DelayShort
- -- Name new book folder
- keystroke posbible & " - " & book
- delay DelayShort
- if book contains "%20" then
- key code 123 using command down -- left
- repeat 9 times
- key code 124 -- right
- delay DelayShort
- end repeat
- repeat 3 times
- key code 51 -- delete
- delay DelayShort
- end repeat
- keystroke " "
- DelayMed
- end if
- key code 36
- delay DelayShort
- end if
- delay DelayLong
- -- Save file
- keystroke "a" using command down
- delay DelayShort
- keystroke abb & "-"
- if chapter < 10 then
- keystroke "0"
- end if
- keystroke chapter
- delay DelayShort
- keystroke ".md"
- delay DelayLong
- key code 36
- delay DelayMed
- -- CLICK INTO TEXT FIELD
- delay DelayShort
- do shell script "eval $(/usr/libexec/path_helper -s); cliclick c:" & textX & "," & textY
- delay DelayShort
- -- BLANK CANVA
- keystroke "a" using {command down}
- delay DelayShort
- key code 51 --delete
- delay DelayMed
- end tell
- set chapter to chapter + 1
- end repeat
- if bigdialog is true then
- set dialogR4 to display dialog "Do you want to continue?" with icon caution buttons {"Exit", "Continue"} default button "Continue" giving up after 5
- if the button returned of dialogR4 is "Exit" then
- error number -128
- end if
- end if
- end repeat
- if shutdown is true then
- delay 10
- tell application "Atom"
- quit
- end tell
- delay 10
- tell application "Safari"
- quit
- end tell
- delay 10
- tell application "Finder"
- shut down
- end tell
- else
- display dialog "Done Importing!" with icon note
- end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement