text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set AppleScript's text item delimiters to {"~"} | eurlexlookup.scpt |
set theResults to every text item of (do shell script "/usr/local/bin/gawk -v FPAT='\"[^\"]+\"|[^,]*' 'BEGIN{RS=\"[\\r\\n]\";ORS=\"~\";OFS=\"\\t\"} NF==7 {split($NF, a, /\\.\\s*#\\s*/) split($2,c,\"/\")};NR!=1&&NF<=7 {print NR-1,a[length(a)],$6,$5,$3,$4,a[length(a)-1]}'<<<" & quoted form of theResponse & "| sed 's/\"//g'" & "| sed 's/\\.\\t/\\t/g'" & "| sed 's/~$//'") --remove double quotes, remove periods followed by field separator (at the end of the case number field), remove trailing record separator, put number in front of results in order to match choice from this list to expression ID from indexlist list. | eurlexlookup.scpt |
set IndexList to every text item of (do shell script "/usr/local/bin/awk -v FPAT='\"[^\"]+\"|[^,]*' 'BEGIN{RS=\"[\\r\\n]\";ORS=\"~\";OFS=\"\\t\"} NF==7 {split($NF, a, /\\.\\s*#\\s*/) split($2,c,\"/\")};NR!=1&&NF<=7 {print c[6]}'<<<" & quoted form of theResponse & "| sed 's/\"//g'" & "| sed 's/\\.\\t/\\t/g'" & "| sed 's/~$//'") --create a list with just the expression IDs of every record | eurlexlookup.scpt |
if theResults is "" then | eurlexlookup.scpt |
display dialog "Could not parse results into a list" | eurlexlookup.scpt |
set theChosenCase to choose from list theResults with title "Search results" with prompt "Please pick the right case. AG opinions are displayed last." OK button name "Select" cancel button name "Quit" | eurlexlookup.scpt |
if theChosenCase is false then | eurlexlookup.scpt |
if the errorNumber is equal to -50 then | eurlexlookup.scpt |
display dialog "There were no results!" | eurlexlookup.scpt |
set IndexChoice to do shell script "awk -F'\\t' '{print $1}'<<<" & quoted form of (theChosenCase as text) --get the number of the choice | eurlexlookup.scpt |
set theExpressionID to do shell script "/usr/local/bin/awk -F~ '{print $" & IndexChoice & "}'<<<" & quoted form of (IndexList as text) --use the choice number to find the matching expression ID. | eurlexlookup.scpt |
set thenewEcli to theCiteKeyYear | eurlexlookup.scpt |
set thenewEcli to do shell script "awk -F'\\t' '{print $5}' <<<" & quoted form of (theChosenCase as text) | eurlexlookup.scpt |
set thenewCaseNo to do shell script "awk -F'\\t' '{print $2}'<<<" & quoted form of (theChosenCase as text) & "| sed -E 's/Case |Joined cases |Joined Cases |Opinion //g'" & "| sed -E 's*([0-9])-([0-9])*\\1\\/\\2*g'" --remove "Case" and replace hyphen in old casenumber with slash | eurlexlookup.scpt |
set thenewDate to the third text item of theCiteKeyYear | eurlexlookup.scpt |
set thenewDate to do shell script "awk -F'\\t' '{split($5,b,\":\"); print b[3]}'<<<" & quoted form of (theChosenCase as text) | eurlexlookup.scpt |
set CELEX to do shell script "awk -F'\\t' '{print $6}'<<<" & quoted form of (theChosenCase as text) | eurlexlookup.scpt |
set theAG to (do shell script "awk -F'\\t' '{print $3}'<<<" & quoted form of (theChosenCase as text)) | eurlexlookup.scpt |
if theAG is not "" then | eurlexlookup.scpt |
set theAG to do shell script "awk -F'\\t' '{print \"Opinion of Advocate General \" $3 \" in\"}'<<<" & quoted form of (theChosenCase as text) | eurlexlookup.scpt |
if the errorNumber is greater than 0 then | eurlexlookup.scpt |
display dialog "Error in parsing the Case you chose" | eurlexlookup.scpt |
set value of field "Ecli" to thenewEcli | eurlexlookup.scpt |
set value of field "Number" to thenewCaseNo | eurlexlookup.scpt |
set value of field "Date" to thenewDate | eurlexlookup.scpt |
set value of field "Author" to "" | eurlexlookup.scpt |
set value of field "Year" to "" | eurlexlookup.scpt |
set value of field "Type" to theAG | eurlexlookup.scpt |
set theUrl to do shell script "awk 'BEGIN{print \"https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:" & quoted form of CELEX & "&rid=1\"}'" | eurlexlookup.scpt |
add theUrl to beginning of linked URLs | eurlexlookup.scpt |
download linked URL 1 with replace | eurlexlookup.scpt |
set theFile to POSIX path of linked file 1 as text | eurlexlookup.scpt |
if theFile contains "." then -- if the attached file is not a PDF, it means there was more than one datastream (pdf) | eurlexlookup.scpt |
set theFileExtension to last text item of theFile | eurlexlookup.scpt |
if theFileExtension contains "pdf" then | eurlexlookup.scpt |
delete linked file 1 --delete the html | eurlexlookup.scpt |
set theExpressionURI to "http://publications.europa.eu/resource/cellar/" & theExpressionID --concatenate the expression URI | eurlexlookup.scpt |
set theMultipleChoiceResponse to (do shell script "curl -H \"Accept:application/pdf\" -H \"Accept-Language:eng\" " & theExpressionURI) --get the error response from the REST API with curl | eurlexlookup.scpt |
do shell script "echo " & quoted form of theMultipleChoiceResponse & ">~/Desktop/output.txt" --uncomment for diagnostics | eurlexlookup.scpt |
set theUrl to (do shell script "awk 'BEGIN{RS=\"title=\\\"item\\\">\";FS=\"<li title=\"} NR>1 {split($1,a,\"\\\"\") split($2,b,\"/>|</\") } {sub(/\\\"stream_name\\\">/, \"\",b[1])} {if (b[1] ~ /(.+ARRET.+)|(.+AVIS.+)/) {print a[2]}}'<<<" & quoted form of theMultipleChoiceResponse as text) --parse the error response and isolate the url whose stream_name has ARRET or AVIS in it, to get the judgment/opinion pdf rather than the report of the hearing | eurlexlookup.scpt |
display dialog "Could not find case URL" | eurlexlookup.scpt |
on GetBridge() | HueScript.applescript |
return "..." -- The Bridge IP | HueScript.applescript |
end GetBridge | HueScript.applescript |
on GetApi() | HueScript.applescript |
return "..." -- Your ApiKey | HueScript.applescript |
end GetApi | HueScript.applescript |
on GetOn() | HueScript.applescript |
set ret to the quoted form of "{\"on\": true,\"hue\": 0, \"sat\": 0,\"bri\": 254}" | HueScript.applescript |
end GetOn | HueScript.applescript |
on GetOff() | HueScript.applescript |
set ret to the quoted form of "{\"on\": false}" | HueScript.applescript |
end GetOff | HueScript.applescript |
on Change(x) | HueScript.applescript |
set BridgeAddress to GetBridge() | HueScript.applescript |
set apiKey to GetApi() | HueScript.applescript |
set Etat to State(x, BridgeAddress, apiKey) | HueScript.applescript |
if Etat = "true" then | HueScript.applescript |
turnOff(x) | HueScript.applescript |
turnOn(x) | HueScript.applescript |
end Change | HueScript.applescript |
on State(x, BridgeAddress, apiKey) | HueScript.applescript |
set LampState to do shell script "curl --request GET http://" & BridgeAddress & "/api/" & apiKey & "/lights/" & x & "/" | HueScript.applescript |
set the_String to LampState | HueScript.applescript |
set AppleScript's text item delimiters to {":", ","} | HueScript.applescript |
set these_items to the text items of the_String | HueScript.applescript |
set Lamppower to (item 3 of these_items) | HueScript.applescript |
return Lamppower | HueScript.applescript |
end State | HueScript.applescript |
on RandomColor(x) | HueScript.applescript |
set hue to (random number from 0 to 65280) as text | HueScript.applescript |
set sat to (random number from 0 to 254) as text | HueScript.applescript |
do shell script "curl --request PUT --data " & "'{\"on\": true,\"hue\": " & hue & ", \"sat\": " & sat & ",\"bri\": 254}'" & " http://" & BridgeAddress & "/api/" & apiKey & "/lights/" & x & "/state/" | HueScript.applescript |
end RandomColor | HueScript.applescript |
on turnOff(x) | HueScript.applescript |
set action to GetOff() | HueScript.applescript |
do shell script "curl --request PUT --data " & action & " http://" & BridgeAddress & "/api/" & apiKey & "/lights/" & x & "/state/" | HueScript.applescript |
on turnOn(x) | HueScript.applescript |
set action to GetOn() | HueScript.applescript |
set myNote to selection | current_selection_to_note_title.scpt |
if (attachment of item 1 of myNote) exists then | current_selection_to_note_title.scpt |
set title of item 1 of myNote to (the clipboard as text) | current_selection_to_note_title.scpt |
set nameFile to (filename of attachment of item 1 of myNote) | current_selection_to_note_title.scpt |
set extFile to (second text item of item 1 of nameFile) | current_selection_to_note_title.scpt |
set filename of attachment of item 1 of myNote to (the clipboard as text) & "." & extFile | current_selection_to_note_title.scpt |
set groupName to "Send Mail Group" | BirthdayReminder.applescript |
tell application "Contacts" to set group_list to name of every person in group groupName | BirthdayReminder.applescript |
if the (count of items in group_list) is greater than 0 then set peopleInList to true | BirthdayReminder.applescript |
if (peopleInList) then | BirthdayReminder.applescript |
set d to (day of (current date)) + 5 | BirthdayReminder.applescript |
set m to month of (current date) | BirthdayReminder.applescript |
set calendarName to "Calendar" | BirthdayReminder.applescript |
set group_list to name of every person in group groupName | BirthdayReminder.applescript |
set tempNames to {} | BirthdayReminder.applescript |
repeat with i from 1 to the count of items in group_list | BirthdayReminder.applescript |
set tempName to name of person i in group groupName | BirthdayReminder.applescript |
set addr to address of person i in group groupName | BirthdayReminder.applescript |
set bday to birth date of person i in group groupName | BirthdayReminder.applescript |
set contactDateValues to value of custom dates of person i in group groupName | BirthdayReminder.applescript |
set contactDateLabels to label of custom dates of person i in group groupName | BirthdayReminder.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.