Photo Paint to Excel via applescript
Photo Paint to Excel via applescript
- Subject: Photo Paint to Excel via applescript
- From: David Hood <email@hidden>
- Date: Mon, 25 Mar 2002 14:39:58 +1200
This isn't a problem, it's just something I thought I'd share.
I needed to know the pixel coordinates of parts of an image. I also wanted this
to be done without me doing the typing, or jumping between programs, so I could
get on with the task at hand. Of the image editors I had access to a lot of them
would give pixel corordinates, but wouldn't automatically log the result. NIH
Image would autolog for groups of up to 25 at a time, but I wanted a bit more
flexibility than that (as I'd be working in lots of 90 or more). While exploring
the options, and contemplating writing something from scratch, I noticed Photo
Paint's dictionary let you get the selection rectangle through applescript. I
could then dump this information into Excel. Works great.
If anyone is interested here are the key bits:
tell application "Corel PHOTO-PAINT 8 LE"
set RectangleMask to GetMaskRectangle
set leftEdge to RectangleMask's Left
set topEdge to RectangleMask's Top
set rightEdge to RectangleMask's Right
set bottomEdge to RectangleMask's Bottom
end tell
tell application "Microsoft Excel"
set startRow to Row of ActiveCell
set startColumn to Column of ActiveCell
set FormulaR1C1 of ActiveCell to Row of ActiveCell
Select Range ("R" & startRow & "C" & (startColumn + 1))
set FormulaR1C1 of ActiveCell to leftEdge
Select Range ("R" & startRow & "C" & (startColumn + 2))
set FormulaR1C1 of ActiveCell to topEdge
Select Range ("R" & startRow & "C" & (startColumn + 3))
set FormulaR1C1 of ActiveCell to rightEdge
Select Range ("R" & startRow & "C" & (startColumn + 4))
set FormulaR1C1 of ActiveCell to bottomEdge
Select Range ("R" & (startRow + 1) & "C" & startColumn)
end tell
tell application "Corel PHOTO-PAINT 8 LE"
activate
end tell
_/_/_/_/_/_/
Research Fellow, The Caversham Project, University of Otago
http://www.otago.ac.nz/nzpg/caversham
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.