text
stringlengths
0
15.7k
source
stringlengths
6
112
set hfsPath to choose file with prompt "ホスト名を入れたテキストファイルを選択してください"
hostname_to_ip_address.applescript
set posixPath to (quoted form of POSIX path of contents of hfsPath) as Unicode text
hostname_to_ip_address.applescript
set ipAddr to do shell script "cat " & posixPath & " | while read i; do smbutil lookup $i; done"
hostname_to_ip_address.applescript
if ipAddr ≠ "" then
hostname_to_ip_address.applescript
do shell script "echo " & return & "/********実行結果" & return & ipAddr & return & "********/" & " >> " & posixPath
hostname_to_ip_address.applescript
else if ipAddr = "" then
hostname_to_ip_address.applescript
display alert "取得できなかったようです!" buttons {"OK"}
hostname_to_ip_address.applescript
display alert "完了しました!" & return & "テキストファイルを確認してください" buttons {"OK"}
hostname_to_ip_address.applescript
property holidayCalendar : "Australian Holidays"
Devonthink%20Daily%20Journal.applescript
property birthdayCalendar : "Birthdays"
Devonthink%20Daily%20Journal.applescript
property worldNews : "http://feeds.bbci.co.uk/news/world/rss.xml"
Devonthink%20Daily%20Journal.applescript
property localNews : "https://thewest.com.au/news/wa/rss"
Devonthink%20Daily%20Journal.applescript
set numHeadlines to 4
Devonthink%20Daily%20Journal.applescript
global theDate, targetPath, numHeadlines
Devonthink%20Daily%20Journal.applescript
property quoteoftheDay : "feed://feeds.feedburner.com/quotationspage/qotd"
Devonthink%20Daily%20Journal.applescript
property weatherAPI : "???" -- obtain from https://openweathermap.org
Devonthink%20Daily%20Journal.applescript
property journalDatabase : "~/Databases/Jornal.dtBase2"
Devonthink%20Daily%20Journal.applescript
set theTime to time string of theDate
Devonthink%20Daily%20Journal.applescript
if character 5 of theTime is ":" then
Devonthink%20Daily%20Journal.applescript
set theTime to (characters 1 through 4 of theTime) & (characters 8 through 10 of theTime) as string
Devonthink%20Daily%20Journal.applescript
set theTime to (characters 1 through 5 of theTime) & (characters 9 through 11 of theTime) as string
Devonthink%20Daily%20Journal.applescript
set theMonth to month of theDate as string
Devonthink%20Daily%20Journal.applescript
set numMonth to (month of theDate as integer) as string
Devonthink%20Daily%20Journal.applescript
if the (length of numMonth) < 2 then set numMonth to "0" & numMonth
Devonthink%20Daily%20Journal.applescript
set theDay to day of theDate as string
Devonthink%20Daily%20Journal.applescript
set shortDay to theDay -- shortDay won't have a leading zero
Devonthink%20Daily%20Journal.applescript
if the (length of theDay) < 2 then set theDay to "0" & theDay
Devonthink%20Daily%20Journal.applescript
set suffixList to {"st", "nd", "rd"}
Devonthink%20Daily%20Journal.applescript
set theIndex to last character of theDay as integer
Devonthink%20Daily%20Journal.applescript
if (theIndex > 0) and (theIndex < 4) and the first character of theDay is not "1" then
Devonthink%20Daily%20Journal.applescript
set daySuffix to item theIndex of suffixList
Devonthink%20Daily%20Journal.applescript
set daySuffix to "th"
Devonthink%20Daily%20Journal.applescript
set longWeekday to weekday of theDate as string
Devonthink%20Daily%20Journal.applescript
set shortWeekday to characters 1 thru 3 of longWeekday
Devonthink%20Daily%20Journal.applescript
set theYear to year of theDate as string
Devonthink%20Daily%20Journal.applescript
set theYearMonth to theYear & "-" & numMonth
Devonthink%20Daily%20Journal.applescript
set recordName to numMonth & "_" & theDay & "_" & theYear & "_" & shortWeekday
Devonthink%20Daily%20Journal.applescript
set newHeading to getWeather() & " " & theTime & return
Devonthink%20Daily%20Journal.applescript
set mainHeading to longWeekday & "," & space & shortDay & daySuffix & space & theMonth & return
Devonthink%20Daily%20Journal.applescript
set newParagraph to " "
Devonthink%20Daily%20Journal.applescript
set calEvents to main() & return
Devonthink%20Daily%20Journal.applescript
property blueColor : {0, 0, 30000}
Devonthink%20Daily%20Journal.applescript
property headerColor : {40000, 20000, 0}
Devonthink%20Daily%20Journal.applescript
property blackColor : {0, 0, 0}
Devonthink%20Daily%20Journal.applescript
property dateColor : {30000, 30000, 30000}
Devonthink%20Daily%20Journal.applescript
tell application "DEVONthink 3"
Devonthink%20Daily%20Journal.applescript
set theDatabase to open database journalDatabase
Devonthink%20Daily%20Journal.applescript
set myGroup to create location "/Journal/" & "/" & theYear & "/" & numMonth & "-" & theMonth
Devonthink%20Daily%20Journal.applescript
set recordName to theYear & "-" & numMonth & "-" & theDay & " " & shortWeekday
Devonthink%20Daily%20Journal.applescript
if not (exists child recordName of myGroup) then
Devonthink%20Daily%20Journal.applescript
set myRecord to create record with {name:recordName, rich text:"", type:rtfd, tags:theYear & "," & theMonth} in myGroup
Devonthink%20Daily%20Journal.applescript
tell text of myRecord
Devonthink%20Daily%20Journal.applescript
make paragraph at beginning with properties {alignment:center, font:"Zapfino", size:18, color:dateColor} with data mainHeading
Devonthink%20Daily%20Journal.applescript
bold first paragraph
Devonthink%20Daily%20Journal.applescript
unbold last character
Devonthink%20Daily%20Journal.applescript
set properties of last character to {font:"Avenir", size:14}
Devonthink%20Daily%20Journal.applescript
make new paragraph at end with properties {alignment:center, font:"Avenir", size:14, color:blueColor} with data calEvents & return
Devonthink%20Daily%20Journal.applescript
set color of last character to blackColor
Devonthink%20Daily%20Journal.applescript
set myQuote to my getQuote()
Devonthink%20Daily%20Journal.applescript
set the last character to the last character & myQuote & return
Devonthink%20Daily%20Journal.applescript
set alignment of last character to left
Devonthink%20Daily%20Journal.applescript
set myNews to my getNewsWorld()
Devonthink%20Daily%20Journal.applescript
set the last character to the last character & "WORLD HEADLINES:" & return
Devonthink%20Daily%20Journal.applescript
bold last paragraph
Devonthink%20Daily%20Journal.applescript
repeat with i from 1 to (count of items of myNews) by 2
Devonthink%20Daily%20Journal.applescript
set the last character to the last character & item i of myNews & return
Devonthink%20Daily%20Journal.applescript
set the URL of the last paragraph to item (i + 1) of myNews
Devonthink%20Daily%20Journal.applescript
make new paragraph at end with data newParagraph
Devonthink%20Daily%20Journal.applescript
set properties of last paragraph to {font:"Avenir", size:14, color:blackColor}
Devonthink%20Daily%20Journal.applescript
set myNews to my getNewsLocal()
Devonthink%20Daily%20Journal.applescript
set the last character to the last paragraph & return & "LOCAL HEADLINES:" & return
Devonthink%20Daily%20Journal.applescript
else -- Record already exists, just add new weather/time header
Devonthink%20Daily%20Journal.applescript
set myRecord to child recordName in myGroup
Devonthink%20Daily%20Journal.applescript
set the last character to the last character & return & return
Devonthink%20Daily%20Journal.applescript
make new paragraph at end with data newHeading
Devonthink%20Daily%20Journal.applescript
set properties of last paragraph to {font:"Avenir", size:16, alignment:left, superscript:2, color:headerColor}
Devonthink%20Daily%20Journal.applescript
italicize last paragraph
Devonthink%20Daily%20Journal.applescript
set properties of last character to {font:"Avenir", size:16, alignment:left, superscript:0, color:blackColor}
Devonthink%20Daily%20Journal.applescript
set last character to last character & "■ "
Devonthink%20Daily%20Journal.applescript
set newHeading to ""
Devonthink%20Daily%20Journal.applescript
display alert (localized string "An error occured when adding the note. ") & errMsg
Devonthink%20Daily%20Journal.applescript
on getWeather()
Devonthink%20Daily%20Journal.applescript
tell application "Location Helper"
Devonthink%20Daily%20Journal.applescript
set listCoords to get location coordinates
Devonthink%20Daily%20Journal.applescript
set _lat to item 1 of listCoords as text
Devonthink%20Daily%20Journal.applescript
set _lon to item 2 of listCoords as text
Devonthink%20Daily%20Journal.applescript
set Weather_Display to ""
Devonthink%20Daily%20Journal.applescript
set getWeathersource to fetch JSON from ("https://api.openweathermap.org/data/2.5/weather?lat=" & _lat & "&lon=" & _lon & "&exclude=minutely,hourly&units=metric&appid=" & weatherAPI)
Devonthink%20Daily%20Journal.applescript
set getWeather to "High: " & temp_max of main of getWeathersource & return & return & "Low: " & temp_min of main of getWeathersource & return & return & "Current: " & temp of main of getWeathersource & return & return & "Humidity: " & humidity of main of getWeathersource & return & return & "Conditions: " & description of item 1 of weather of getWeathersource
Devonthink%20Daily%20Journal.applescript
set Current_Temp to (round (temp of main of getWeathersource)) & "°"
Devonthink%20Daily%20Journal.applescript
set Daily_Temp to "Min " & (round (temp_min of main of getWeathersource)) & "° " & "to a " & "Max " & (round (temp_max of main of getWeathersource)) & "°"
Devonthink%20Daily%20Journal.applescript
set Weather_Display to "## Weather" & return & return & getWeather & return & return
Devonthink%20Daily%20Journal.applescript
if Weather_Display contains "clear" then
Devonthink%20Daily%20Journal.applescript
set WeatherIcon to "☀️"
Devonthink%20Daily%20Journal.applescript
else if Weather_Display contains "thunderstorm" then
Devonthink%20Daily%20Journal.applescript
set WeatherIcon to "🌧⚡️"
Devonthink%20Daily%20Journal.applescript
else if Weather_Display contains "drizzle" then
Devonthink%20Daily%20Journal.applescript
set WeatherIcon to "🌦"
Devonthink%20Daily%20Journal.applescript
else if Weather_Display contains "rain" then
Devonthink%20Daily%20Journal.applescript
set WeatherIcon to "🌧"
Devonthink%20Daily%20Journal.applescript