text
stringlengths
0
15.7k
source
stringlengths
6
112
set f to display dialog "Which fields do you want?" buttons {"BPM", "Key", "Both"} giving up after 15 default button "Both"
djay2itunes.scpt
set fields to button returned of f
djay2itunes.scpt
set o to display dialog "Replace existing iTunes data?" buttons {"No", "Yes"} giving up after 15 default button "Yes"
djay2itunes.scpt
set overwrite_tag to button returned of o
djay2itunes.scpt
set selR to selection
djay2itunes.scpt
set sel to a reference to selR -- faster
djay2itunes.scpt
repeat with t from 1 to (length of selR)
djay2itunes.scpt
set theT to item t of sel
djay2itunes.scpt
if class of theT is file track then
djay2itunes.scpt
tell theT
djay2itunes.scpt
set theId to persistent ID
djay2itunes.scpt
set dur to duration
djay2itunes.scpt
set manualKey to name & " " & artist & " " & (round dur rounding to nearest)
djay2itunes.scpt
set manualKey to do shell script "shopt -u xpg_echo; export LANG='" & user locale of (system info) & ".UTF-8'; echo " & quoted form of manualKey & " | tr [:upper:] [:lower:]"
djay2itunes.scpt
if (fields is "BPM" or fields is "Both") then
djay2itunes.scpt
if (bpm of theT is 0 or overwrite_tag is "Yes") then
djay2itunes.scpt
set bpm_djay to 0
djay2itunes.scpt
set manual_bpm_djay to 0
djay2itunes.scpt
set auto_bpm_djay to 0
djay2itunes.scpt
tell property list file (manual_data_path)
djay2itunes.scpt
tell property list item "Song Entries"
djay2itunes.scpt
set theItem to (property list item manualKey)
djay2itunes.scpt
set manual_bpm_djay to (value of property list item "song.manualBpm" of (theItem))
djay2itunes.scpt
tell property list file (auto_data_path)
djay2itunes.scpt
set theItem to (property list item theId)
djay2itunes.scpt
set auto_bpm_djay to (value of property list item "bpm" of (theItem))
djay2itunes.scpt
if (manual_bpm_djay is not 0) then
djay2itunes.scpt
set bpm_djay to manual_bpm_djay
djay2itunes.scpt
else if (auto_bpm_djay is not 0) then
djay2itunes.scpt
set bpm_djay to auto_bpm_djay
djay2itunes.scpt
if (bpm_djay is not 0) then
djay2itunes.scpt
set bpm of theT to (round bpm_djay rounding to nearest)
djay2itunes.scpt
if (fields is "Key" or fields is "Both") then
djay2itunes.scpt
if (grouping of theT is 0 or overwrite_tag is "Yes") then
djay2itunes.scpt
set key_djay to -1
djay2itunes.scpt
set key_djay to (value of property list item "key" of (theItem))
djay2itunes.scpt
if (key_djay is not -1) then
djay2itunes.scpt
set key_djay_string to item (key_djay + 1) of all_keys
djay2itunes.scpt
set old_grouping to grouping of theT
djay2itunes.scpt
if old_grouping is not "" then
djay2itunes.scpt
set possible_key to first text item of old_grouping
djay2itunes.scpt
log possible_key
djay2itunes.scpt
if all_keys contains possible_key then
djay2itunes.scpt
set AppleScript's text item delimiters to possible_key
djay2itunes.scpt
set old_grouping to text item 2 of old_grouping
djay2itunes.scpt
set grouping of theT to key_djay_string & old_grouping
djay2itunes.scpt
set grouping of theT to key_djay_string & " " & old_grouping
djay2itunes.scpt
set grouping of theT to key_djay_string
djay2itunes.scpt
if frontmost is true then display dialog "Done!" buttons {"Thanks"} ¬
djay2itunes.scpt
default button 1 with icon 1 giving up after 15
djay2itunes.scpt
display dialog "Please select a few tracks in iTunes and try again!" buttons {"OK"} giving up after 15
djay2itunes.scpt
set ib to inbox
Auto OCR pending.applescript
do shell script "mkdir -p /tmp/abbyy/"
Auto OCR pending.applescript
do shell script "mkdir -p /tmp/abbyy/mrc/"
Auto OCR pending.applescript
set itemPath to path of theRecord
Auto OCR pending.applescript
set itemName to name of theRecord
Auto OCR pending.applescript
set pdfPath to "/tmp/abbyy/" & itemName & ".pdf"
Auto OCR pending.applescript
set pdfMRCPath to "/tmp/abbyy/mrc/" & itemName & ".pdf"
Auto OCR pending.applescript
export to pdf pdfPath from file itemPath image quality high quality ocr languages enum [Japanese, English]
Auto OCR pending.applescript
set newRecord to import pdfPath to ib
Auto OCR pending.applescript
tell newRecord
Auto OCR pending.applescript
set tags to text items of ["ocr_done"]
Auto OCR pending.applescript
export to pdf pdfMRCPath from file itemPath image quality high quality ocr languages enum [Japanese, English] with use mrc
Auto OCR pending.applescript
set newRecord to import pdfMRCPath to ib
Auto OCR pending.applescript
set tags to text items of ["ocr_done", "mrc"]
Auto OCR pending.applescript
set FOLDER_PATH_KEY to "Temporary Path"
setup-some-path.applescript
set PLIST_PATH to "~/applescript-core/config-user.plist"
setup-some-path.applescript
set currentPath to do shell script "plutil -extract '" & FOLDER_PATH_KEY & "' raw $PLIST_PATH"
setup-some-path.applescript
set defaultPosixPath to "/Users/" & username
setup-some-path.applescript
set chosenFolder to choose folder with prompt "Please select a folder:" default location POSIX file defaultPosixPath
setup-some-path.applescript
do shell script "plutil -replace '" & FOLDER_PATH_KEY & "' -string \"" & posixPath & "\" $PLIST_PATH"
setup-some-path.applescript
if (do shell script "uptime") contains "mins," then
uptime_and_wifi.applescript
set uptime to do shell script "uptime | awk -F 'mins,' '{print $1}' | awk '{print $3}'"
uptime_and_wifi.applescript
set uptime to do shell script "uptime | awk -F ',' '{print $1}' | awk '{print $3}' | awk -F ':' '{hrs=$1; min=$2; print hrs*60 + min}'"
uptime_and_wifi.applescript
if (uptime as integer) > 9 then
uptime_and_wifi.applescript
return uptime
uptime_and_wifi.applescript
set wifi_name to do shell script "networksetup -getairportnetwork en0 | awk -F ': ' '{print $2}'"
uptime_and_wifi.applescript
if wifi_name = "Sina Plaza Mobile" then return do shell script "networksetup -setairportnetwork en0 'Sina Plaza Office' urtheone"
uptime_and_wifi.applescript
log pingNetworkAddress("8.8.8.8", 3)
pingNetworkAddress.applescript
log pingNetworkAddress("apple.com", 3)
pingNetworkAddress.applescript
on pingNetworkAddress(anAddress, aTimeout)
pingNetworkAddress.applescript
script NetworkPinger
pingNetworkAddress.applescript
property pingToolPID : false
pingNetworkAddress.applescript
property pingOutputFilePath : false
pingNetworkAddress.applescript
on ping()
pingNetworkAddress.applescript
runPingTool()
pingNetworkAddress.applescript
set pingResult to checkResult()
pingNetworkAddress.applescript
return pingResult
pingNetworkAddress.applescript
on runPingTool()
pingNetworkAddress.applescript
set pingOutputFilePath to temporaryPath()
pingNetworkAddress.applescript
set pid to do shell script "/sbin/ping -c 1 " & networkAddress & " > " & quoted form of (POSIX path of pingOutputFilePath) & " 2>&1 & echo $!"
pingNetworkAddress.applescript
set pingToolPID to pid as integer
pingNetworkAddress.applescript
set pingToolPID to false
pingNetworkAddress.applescript
end runPingTool
pingNetworkAddress.applescript
set pingResult to false
pingNetworkAddress.applescript
set pingOutput to readFile(pingOutputFilePath, text)
pingNetworkAddress.applescript
if pingOutput contains " 0% packet loss" or pingOutput contains " 0.0% packet loss" then
pingNetworkAddress.applescript
set pingResult to true
pingNetworkAddress.applescript
if pingToolPID is not false then do shell script "/bin/kill " & (pingToolPID as text)
pingNetworkAddress.applescript
tell application "System Events" to delete file pingOutputFilePath
pingNetworkAddress.applescript