rOr you could do one of these

----------------------  A ONE LINER

tell application "Adobe Photoshop CS3" to return (the number of documents)

---------------------- A FEW LINER
tell application "Adobe Photoshop CS3"
        set the docAsItemList to every document
        --now we have a Applescript list of all the docs
        set docItemCnt to the number of items in docAsItemList
        return docItemCnt
end tell

----------------------  DEMO OF LOOP TYPES and LISTS
--simple repeat loop at the end to return data to Rev that is a bit easier to parse
tell application "Adobe Photoshop CS3"
        set the docsAsItemList to every document
        --now we have a Applescript list of all the docs
        set docItemCnt to the number of items in docsAsItemList
        
        set nameslistViaWithEach to {}
        repeat with thisDocItem in docsAsItemList
                copy the name of thisDocItem to end of nameslistViaWithEach
        end repeat
        
        --or--------------
        set namesListViaWithX to {}
        repeat with x from 1 to number of items in the docsAsItemList
                copy the name of item x of docsAsItemList to end of 
namesListViaWithX
        end repeat
        
end tell
set output to docItemCnt

repeat with echItm in docsAsItemList
        set output to output & return & the name of echItm as string
end repeat
--of course this repeat could be done with either of the 3 lists we have defined and gathered
--docsAsItemList, nameslistViaWithEach, namesListViaWithX

return output -- this is formatted without quotes except char 1 and char -1

------------------------
Jim Ault
Las Vegas



On Mar 11, 2009, at 1:13 PM, Jim Sims wrote:

I'm trying to get a count of open photoshop image files. They do not show up using terminal and lsof. Therefore I am undergoing an exercise that always reinforces how much I like using Rev - using applescript. :-P

The following result will tell me how many image files are open in "Photoshop Elements 4.0" My problem is that it looks for a set number of times (30) and then tells me the count.

I would like to have it not perform the repeat with a set number (as in 30) but to count until it knows that it got them all. IOW so it quits repeating after a counter of N if there are N files open. Hope I'm making sense here :-/

Any applescript Gurus out there?


set z to 0
set x to 0
repeat 30 times
        tell application "Photoshop Elements 4.0"
                set x to x + 1
                if exists document x then set z to z + 1
                set counter to z
        end tell
        
end repeat
return counter

sims

[email protected]
Skype:   sims.jim
iChat:   techietours
______________________
Opportunity by Design




_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to