|
Size: 3044
Comment: No progress. I should probably think vector.
|
Size: 3491
Comment: Preformatting
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| set pixel to latLongToPixel(45.5192, -122.6856) |
set pdxSpotList to (homePath & "Desktop:spots.xls") set pdxMapOriginal to (homePath & "Desktop:bikemap.pdf" as alias) set resultGraphic to (homePath & "Desktop:pdx.png") set myList to {} tell application "Microsoft Excel" Open pdxSpotList set myRow to 1 repeat set tuple to {} repeat with myColumn from 1 to 3 set currentCell to "R" & myRow & "C" & myColumn as string set cellText to text of Cell currentCell if cellText is "" then exit repeat set end of tuple to cellText end repeat if cellText is "" then exit repeat set end of myList to tuple set myRow to myRow + 1 end repeat Quit end tell |
| Line 7: | Line 34: |
|
open (homePath & "Desktop:bikemap.pdf" as alias) crop current document bounds {46, 72, 1276, 1220} make new art layer at beginning of current document ¬ with properties {name:"MakerLayer", blend mode:normal} |
open pdxMapOriginal |
| Line 12: | Line 36: |
|
set x to item 1 of pixel set y to item 2 of pixel |
set maxX to 0 set maxY to 0 set minX to 2000 set minY to 2000 |
| Line 15: | Line 41: |
|
set selShape to "Elps" -- "Rctn" set selTop to x set selLeft to y set selBottom to 40 + x set selRight to 40 + y set antiAlias to true set featherAmt to 0.0 do javascript ("function makeEllipseSelection(selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt) { |
repeat with z in myList set spotName to item 1 of z set x to item 2 of z set y to item 3 of z if x is greater than maxX then set maxX to (x + 20) if y is greater than maxY then set maxY to (y + 20) if minX is greater than x then set minX to (x - 20) if minY is greater than y then set minY to (y - 20) make new art layer at beginning of current document ¬ with properties {name:spotName, blend mode:normal} set selShape to "Elps" -- "Rctn" set selTop to y - 20 set selLeft to x - 20 set selBottom to y + 20 set selRight to x + 20 set antiAlias to true set featherAmt to 0.0 do javascript ("function makeEllipseSelection(selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt) { |
| Line 38: | Line 79: |
| with arguments {selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt} |
with arguments {selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt} fill selection of current document with contents ¬ {class:RGB color, red:81, green:172, blue:205} blend mode ¬ vivid light opacity 90 without preserving transparency end repeat |
| Line 40: | Line 87: |
|
fill selection of current document with contents ¬ {class:RGB color, red:81, green:172, blue:205} blend mode ¬ vivid light opacity 90 without preserving transparency |
display dialog "minX: " & minX & " miny: " & minY & " maxX: " & maxX & " maxY: " & maxY |
| Line 44: | Line 89: |
| crop current document bounds {minX, minY, maxX, maxY} -- {46, 72, 1276, 1220} | |
| Line 45: | Line 91: |
|
-- save current document in (homePath & "Desktop:pdx.png") as PNG -- quit end tell on latLongToPixel(lat, long) |
-- save current document in resultGraphic as PNG with copying |
| Line 51: | Line 93: |
|
-- This function leaves a lot to be desired set lat to 45.5192 -- Burnside Bridge 45.5229 -122.6673 -- Pioneer Square 45.5192 -122.6856 -- Burnside Bridge 520, 647 -- Pioneer Square 464, 678 set burnsideGeo to {45.5229, -122.6673} set piosqrGeo to {45.5192, -122.6856} set burnsidePix to {520, 647} set piosqrPix to {464, 678} set pixPerGeo to ((item 1 of burnsideGeo) - (item 1 of piosqrGeo)) / ((item 1 of burnsidePix) - (item 1 of piosqrPix)) display dialog (item 1 of burnsidePix) - ((item 1 of burnsideGeo) - lat) * pixPerGeo return {0, 0} end latLongToPixel}}} |
end tell}} |
{{{tell application "Finder" to set homePath to (home as string)
set pdxSpotList to (homePath & "Desktop:spots.xls") set pdxMapOriginal to (homePath & "Desktop:bikemap.pdf" as alias) set resultGraphic to (homePath & "Desktop:pdx.png")
set myList to {}
tell application "Microsoft Excel"
- Open pdxSpotList set myRow to 1 repeat
- set tuple to {} repeat with myColumn from 1 to 3
set currentCell to "R" & myRow & "C" & myColumn as string set cellText to text of Cell currentCell if cellText is "" then exit repeat set end of tuple to cellText
- set tuple to {} repeat with myColumn from 1 to 3
end tell
tell application "Adobe Photoshop CS"
- activate open pdxMapOriginal set maxX to 0 set maxY to 0 set minX to 2000 set minY to 2000 repeat with z in myList
- set spotName to item 1 of z set x to item 2 of z set y to item 3 of z if x is greater than maxX then set maxX to (x + 20) if y is greater than maxY then set maxY to (y + 20) if minX is greater than x then set minX to (x - 20) if minY is greater than y then set minY to (y - 20) make new art layer at beginning of current document ¬
- with properties {name:spotName, blend mode:normal}
var selectionChannel = new ActionReference();
- selectionChannel.putProperty( charIDToTypeID( \"Chnl\" ), charIDToTypeID( \"fsel\" ) );
var makeSelection = new ActionDescriptor();
- makeSelection.putReference( charIDToTypeID( \"null\" ), selectionChannel );
var selectionParameters = new ActionDescriptor();
- selectionParameters.putUnitDouble( charIDToTypeID( \"Top \" ), charIDToTypeID( \"#Pxl\" ), selTop ); selectionParameters.putUnitDouble( charIDToTypeID( \"Left\" ), charIDToTypeID( \"#Pxl\" ), selLeft ); selectionParameters.putUnitDouble( charIDToTypeID( \"Btom\" ), charIDToTypeID( \"#Pxl\" ), selBottom ); selectionParameters.putUnitDouble( charIDToTypeID( \"Rght\" ), charIDToTypeID( \"#Pxl\" ), selRight ); makeSelection.putObject( charIDToTypeID( \"T \" ), charIDToTypeID( selShape ), selectionParameters ); makeSelection.putUnitDouble( charIDToTypeID( \"Fthr\" ), charIDToTypeID( \"#Pxl\" ), featherAmt ); makeSelection.putBoolean( charIDToTypeID( \"AntA\" ), antiAlias );
executeAction( charIDToTypeID( \"setd\" ), makeSelection, DialogModes.NO );
- with arguments {selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt}
- fill selection of current document with contents ¬
- {class:RGB color, red:81, green:172, blue:205} blend mode ¬ vivid light opacity 90 without preserving transparency
display dialog "minX: " & minX & " miny: " & minY & " maxX: " & maxX & " maxY: " & maxY crop current document bounds {minX, minY, maxX, maxY} -- {46, 72, 1276, 1220} -- resize image current document width 450 -- save current document in resultGraphic as PNG with copying
- set spotName to item 1 of z set x to item 2 of z set y to item 3 of z if x is greater than maxX then set maxX to (x + 20) if y is greater than maxY then set maxY to (y + 20) if minX is greater than x then set minX to (x - 20) if minY is greater than y then set minY to (y - 20) make new art layer at beginning of current document ¬
end tell}}

