Еще комментарии этого пользователя
adsky ⸬ 26 февраля 2018, 08:32 ⸬ Saint Petersburg, RU ⸬ Apple
#
> [тыц]
set defDel to AppleScript's text item delimiters
set AppleScript's text item delimiters to "-"
set newname to text items of temp
set AppleScript's text item delimiters to "−"
set the temp to (newname as string)
set AppleScript's text item delimiters to defDel
adsky ⸬ 22 февраля 2018, 16:22 ⸬ Saint Petersburg, RU ⸬ Apple
#
можно еще добавить иконку погоды:

set cond_icon to icon of item 1 of weather of weather as string

if cond_icon is in ["01d", "01n"] then
set cond to "☀"
else if cond_icon is in ["02d", "02n", "03d", "03n", "04d", "04n"] then
set cond to "☁"
else if cond_icon is in ["09d", "09n", "10d", "10n"] then
set cond to "☂"
else if cond_icon is in ["11d", "11n"] then
set cond to "☈"
else if cond_icon is in ["13d", "13n"] then
set cond to "☃"
else if cond_icon is in ["50d", "50n"] then
set cond to "♨"
else
set cond to ""
end if

return cond & " " & temp & "°C"
adsky ⸬ 22 февраля 2018, 11:46 ⸬ Saint Petersburg, RU ⸬ Apple
#
> [тыц]
# https://itunes.apple.com/ru/app/json-helper-for-applescript/id453114608?l=en&mt=12
# https://itunes.apple.com/ru/app/location-helper-for-applescript/id488536386?mt=12
tell application "Location Helper"
set clocation_coords to get location coordinates
tell application "JSON Helper"
set weather to fetch JSON from "http://api.openweathermap.org/data/2.5/weather?lat=" & item 1 of clocation_coords & "&lon=" & item 2 of clocation_coords & "&units=metric&appid=..."
set temp to temp of main of weather as string
return temp & "°C"
end tell
end tell
adsky ⸬ 22 февраля 2018, 07:50 ⸬ Saint Petersburg, RU ⸬ Apple
#
В статье не указано, но чтобы было красиво как на картинках, то нужно в настройках BTT (Touchbar -> General Touch Bar Settings) убрать галку с Show macOS Control Strip :)
adsky ⸬ 22 февраля 2018, 07:44 ⸬ Saint Petersburg, RU ⸬ Apple
#
для файндера лучше сделать так (вместо хардкода пути "/Mac HD/Users/vas3k"):

tell application "Finder"
set homeFolder to path to home folder as string
make new Finder window
set target of front window to homeFolder
activate
end tell
me@vas3k.ru :: telegram :: twitter :: instagram :: facebook :: github