Need help getting field values of each selected record in Portfolio

Hi,

Thanks to many of you, I now have an AppleScript Studio interface that allows me to enter information (myClaimInfo) that is applied to every record that has been selected in Portfolio 8. However, I have not found a way to alter the information entered into each record (via myClaimInfo) based on a custom Portfolio field (“Outtake”) in each selected record.

Here’s the AppleScript portion of what I’ve got so far:


		tell application "Portfolio 8.1"
			activate
			tell document 1
				try -- 11/17/09:	 Put in this try statement in case no records are selected.
					set mySelections to get ID of selection of gallery 1 -- 11/11/09: this gets the IDs of the selected records.
					if (count of mySelections) = 0 then
						display dialog "No images were selected." buttons {"Cancel"} default button "Cancel"
						quit
					end if
				end try
				try
					repeat with i from 1 to count of mySelections -- 11/17/09. This works.
						display dialog item i of mySelections -- Shows the ID of the first selected record.
						--set myOuttake to get contents of field "Outtake" of item i of gallery 1 as string-- DOES NOT WORK.
						--set myOuttake to get value of field "Outtake" of selection of gallery 1 as string --DOES NOT WORK
						if myOuttake = "x" then  -- I CAN'T GET THE OUTTAKE FIELD's VALUE FOR EACH SELECTED RECORD.
						set value of field "Used by Client, Job #, Ship Date" of selection of gallery 1 to myClaimInfo & " (outtake)"
							else
						set value of field "Used by Client, Job #, Ship Date" of selection of gallery 1 to myClaimInfo 
						end if
						set value of field "zAll ship dates" of selection of gallery 1 to myShipDate as string -- This works
					end repeat
				end try
				
				tell gallery 1 -- 11/9/09: This is a cheap way to refresh the item view so the new "used by" information is displayed. Heh heh ...
					set view to 1
					set view to 3
				end tell
			end tell
		end tell

I feel like I’m close to having a script that will be very beneficial in terms of data entry and our company’s methods of “claiming” photos for client publications via Portfolio. This forum has been super helpful, so any tips you can provide will once again be greatly appreciated. Thanks!

Dadoo,

I’ve been having a hassle w/ PF too, but found one thing that might be of interest to you in the script you posted here:

NOTE: The value of “item i of mySelections – Shows the ID of the first selected record” is a NUMBER (integer). That is not the value you need in the following lines:
“set myOuttake to get contents of field “Outtake” of item i of gallery 1 as string-- DOES NOT WORK.”

I believe you will have success if you change “item i” to:
“record id (item i of mySelections)”

Yes?

G’luck!

  • Dan