text
stringlengths
0
15.7k
source
stringlengths
6
112
if length of myGoals is 0 then
Beemind Anything 🐝.applescript
display notification "⚠️ No goals returned"
Beemind Anything 🐝.applescript
repeat with g in myGoals
Beemind Anything 🐝.applescript
set due to (my convertUnixTimeStamp(convertNumberToString(losedate of g)))
Beemind Anything 🐝.applescript
if (due < (current date) - (time of (current date)) + (60 * 60 * t1AlertHours)) then
Beemind Anything 🐝.applescript
set displayName to (slug of g & t1AlertLabel)
Beemind Anything 🐝.applescript
if amount of contract of g > 0 then
Beemind Anything 🐝.applescript
set displayName to displayName & "($" & (amount of contract of g as integer as text) & ")"
Beemind Anything 🐝.applescript
else if (due < (current date) - (time of (current date)) + (60 * 60 * t2AlertHours)) then
Beemind Anything 🐝.applescript
set displayName to (slug of g & t2AlertLabel)
Beemind Anything 🐝.applescript
else if (due < (current date) - (time of (current date)) + (60 * 60 * t3AlertHours)) then
Beemind Anything 🐝.applescript
set displayName to (slug of g & t3AlertLabel)
Beemind Anything 🐝.applescript
set displayName to slug of g
Beemind Anything 🐝.applescript
set displayNames to displayNames & displayName
Beemind Anything 🐝.applescript
set mySelection to choose from list displayNames with prompt "Which goal do you want to Beemind? 🐝"
Beemind Anything 🐝.applescript
if mySelection is false then return
Beemind Anything 🐝.applescript
set myGoal to (first text item of (mySelection as text))
Beemind Anything 🐝.applescript
set dataPointValue to text returned of (display dialog "What value do you want to log to " & myGoal & "?" default answer defaultBeeValue)
Beemind Anything 🐝.applescript
set dataPointComment to text returned of (display dialog "Comment for this " & myGoal & " data point:" default answer "")
Beemind Anything 🐝.applescript
my log_item(myGoal, dataPointValue, dataPointComment)
Beemind Anything 🐝.applescript
on fetch_goals()
Beemind Anything 🐝.applescript
set theResult to (do shell script "curl -X GET https://www.beeminder.com/api/v1/users/" & beeUser & "/goals.json?auth_token=" & beeAuthToken & "&skinny=true")
Beemind Anything 🐝.applescript
tell application "JSON Helper" to set myGoalList to (read JSON from theResult)
Beemind Anything 🐝.applescript
return myGoalList
Beemind Anything 🐝.applescript
end fetch_goals
Beemind Anything 🐝.applescript
on log_item(myGoal, itemValue, itemDescription)
Beemind Anything 🐝.applescript
set quotedDescription to quoted form of itemDescription
Beemind Anything 🐝.applescript
set theResult to (do shell script "curl -X POST https://www.beeminder.com/api/v1/users/" & beeUser & "/goals/" & myGoal & "/datapoints.json -d auth_token=" & beeAuthToken & " -d value=" & itemValue & " -d comment=" & quotedDescription)
Beemind Anything 🐝.applescript
set theStatus to status of (read JSON from theResult)
Beemind Anything 🐝.applescript
set canonical to canonical of (read JSON from theResult)
Beemind Anything 🐝.applescript
if theStatus is "created" then
Beemind Anything 🐝.applescript
display notification "βœ… \"" & itemDescription & "\" " & canonical & " β†’ " & myGoal
Beemind Anything 🐝.applescript
display notification "⚠️ " & theStatus
Beemind Anything 🐝.applescript
display notification "⚠️ something went wrong"
Beemind Anything 🐝.applescript
end log_item
Beemind Anything 🐝.applescript
on convertNumberToString(theNumber)
Beemind Anything 🐝.applescript
set theNumberString to theNumber as string
Beemind Anything 🐝.applescript
set theOffset to offset of "E" in theNumberString
Beemind Anything 🐝.applescript
if theOffset = 0 then return theNumberString
Beemind Anything 🐝.applescript
set thePrefix to text 1 thru (theOffset - 1) of theNumberString
Beemind Anything 🐝.applescript
set theConvertedNumberPrefix to ""
Beemind Anything 🐝.applescript
if thePrefix begins with "-" then
Beemind Anything 🐝.applescript
set theConvertedNumberPrefix to "-"
Beemind Anything 🐝.applescript
if thePrefix = "-" then
Beemind Anything 🐝.applescript
set thePrefix to ""
Beemind Anything 🐝.applescript
set thePrefix to text 2 thru -1 of thePrefix
Beemind Anything 🐝.applescript
set theDecimalAdjustment to (text (theOffset + 1) thru -1 of theNumberString) as number
Beemind Anything 🐝.applescript
set isNegativeDecimalAdjustment to theDecimalAdjustment is less than 0
Beemind Anything 🐝.applescript
if isNegativeDecimalAdjustment then
Beemind Anything 🐝.applescript
set thePrefix to (reverse of (characters of thePrefix)) as string
Beemind Anything 🐝.applescript
set theDecimalAdjustment to -theDecimalAdjustment
Beemind Anything 🐝.applescript
set theDecimalOffset to offset of "." in thePrefix
Beemind Anything 🐝.applescript
if theDecimalOffset = 0 then
Beemind Anything 🐝.applescript
set theFirstPart to ""
Beemind Anything 🐝.applescript
set theFirstPart to text 1 thru (theDecimalOffset - 1) of thePrefix
Beemind Anything 🐝.applescript
set theSecondPart to text (theDecimalOffset + 1) thru -1 of thePrefix
Beemind Anything 🐝.applescript
set theConvertedNumber to theFirstPart
Beemind Anything 🐝.applescript
set theRepeatCount to theDecimalAdjustment
Beemind Anything 🐝.applescript
if (length of theSecondPart) is greater than theRepeatCount then set theRepeatCount to length of theSecondPart
Beemind Anything 🐝.applescript
repeat with a from 1 to theRepeatCount
Beemind Anything 🐝.applescript
set theConvertedNumber to theConvertedNumber & character a of theSecondPart
Beemind Anything 🐝.applescript
set theConvertedNumber to theConvertedNumber & "0"
Beemind Anything 🐝.applescript
if a = theDecimalAdjustment and a is not equal to (length of theSecondPart) then set theConvertedNumber to theConvertedNumber & "."
Beemind Anything 🐝.applescript
if theConvertedNumber ends with "." then set theConvertedNumber to theConvertedNumber & "0"
Beemind Anything 🐝.applescript
if isNegativeDecimalAdjustment then set theConvertedNumber to (reverse of (characters of theConvertedNumber)) as string
Beemind Anything 🐝.applescript
return theConvertedNumberPrefix & theConvertedNumber
Beemind Anything 🐝.applescript
end convertNumberToString
Beemind Anything 🐝.applescript
on convertUnixTimeStamp(UTS)
Beemind Anything 🐝.applescript
set c to "date -r " & UTS & " \"+%m/%d/%Y %H:%M\""
Beemind Anything 🐝.applescript
return date ((do shell script c) as string)
Beemind Anything 🐝.applescript
end convertUnixTimeStamp
Beemind Anything 🐝.applescript
my main()
Beemind Anything 🐝.applescript
set passAns to "app123"
FinderUsernameAndPassword.applescript
set userAns to "John"
FinderUsernameAndPassword.applescript
if the text returned of (display dialog "Username" default answer "") is userAns then
FinderUsernameAndPassword.applescript
display dialog "Correct" buttons {"Continue"} default button 1
FinderUsernameAndPassword.applescript
if the text returned of (display dialog "Username : John" & return & "Password" default answer "" buttons {"Continue"} default button 1 with hidden answer) is passAns then
FinderUsernameAndPassword.applescript
display dialog "Access granted" buttons {"OK"} default button 1
FinderUsernameAndPassword.applescript
display dialog "Incorrect password" buttons {"OK"} default button 1
FinderUsernameAndPassword.applescript
display dialog "Incorrect username" buttons {"OK"} default button 1
FinderUsernameAndPassword.applescript
if (count of input) is 0 then
keynote to powerpoint.applescript
set pathList to {}
keynote to powerpoint.applescript
repeat with itemNum from 1 to count of input
keynote to powerpoint.applescript
copy POSIX path of (container of (item itemNum of input)) to end of pathList
keynote to powerpoint.applescript
set pathList to (item 1 of pathList as string) & "/"
keynote to powerpoint.applescript
set tempFolder to POSIX path of pathList & "PPTX"
keynote to powerpoint.applescript
if not fileExists(tempFolder) then
keynote to powerpoint.applescript
do shell script "mkdir " & quoted form of POSIX path of tempFolder
keynote to powerpoint.applescript
set the defaultDestinationFolder to POSIX file tempFolder as alias
keynote to powerpoint.applescript
repeat with keynotefile in input
keynote to powerpoint.applescript
if name extension of (info for keynotefile) is not "key" then
keynote to powerpoint.applescript
open keynotefile
keynote to powerpoint.applescript
set documentName to its name
keynote to powerpoint.applescript
set movieCount to the count of every movie of every slide
keynote to powerpoint.applescript
set audioClipCount to the count of every audio clip of every slide
keynote to powerpoint.applescript
set MicrosoftPowerPointFileExtension to "pptx"
keynote to powerpoint.applescript
set newExportItemName to documentName & "." & MicrosoftPowerPointFileExtension
keynote to powerpoint.applescript
repeat until not (exists document file newExportItemName of defaultDestinationFolder)
keynote to powerpoint.applescript
set newExportItemName to Β¬
keynote to powerpoint.applescript
documentName & "-" & (incrementIndex as string) & "." & MicrosoftPowerPointFileExtension
keynote to powerpoint.applescript