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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.