iView home page
iView Multimedia Forum Index

FAQ FAQ     SearchSearch     MemberlistMemberlist     UsergroupsUsergroups    RegisterRegister  
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to open from MediaPro script into Photoshop?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> VB Script
View previous topic :: View next topic  
Author Message
drmrbrewer



Joined: 24 Sep 2005
Posts: 510
Location: UK

PostPosted: Mon Dec 12, 2005 9:31 am    Post subject: How to open from MediaPro script into Photoshop? Reply with quote

All I want to do is, for each selected media item in turn, open it up into Photoshop and run a Photoshop action on it.

Sounds simple, and probably is, but I can't work it out. I thought that it might be a simple case of creating a droplet for the Photoshop action concerned, making that a helper application in MediaPro, and then just selecting the media items I want in MediaPro, and choosing "Open With" for the PS droplet. That would be ideal.

However, all this seems to do is just throw the media items into PS as fast as it can, so that the second item is sent to Photoshop when processing on the first item has only just begun, and so on.

So I figure you have to do this from a script, but am struggling.

It is easy enough to start up both MediaPro and Photoshop and get pointers to both:

Code:
iViewApp = CreateObject("iView.Application");
PhotoshopApp = CreateObject("Photoshop.Application");


And then easy to loop through each MediaItem in the ActiveCatalog of MediaPro.

And easy to start the action running in Photoshop once the appropriate MediaItem has been loaded in.

But how do you get the MediaItem into Photoshop in the first place?

For a (java) script running under Photoshop you might do:

Code:
var sampleDocToOpen = File(“/File/Is/Here.jpeg”);
open(sampleDocToOpen);


But this won't mean anything when run in a script from within MediaPro, only when run in a script from within Photoshop.

Any ideas? I don't mind much whether the scripting is done in VB or JS.

Thanks!

Mike
Back to top
View user's profile Send private message
drmrbrewer



Joined: 24 Sep 2005
Posts: 510
Location: UK

PostPosted: Mon Dec 12, 2005 9:48 pm    Post subject: Server Busy message Reply with quote

OK. I have so nearly got this working. By using VB instead of JS, you can get away with not having to create a File object.

The following bit of VB code goes through each selected media item in turn, and opens it up into Photoshop, then runs an action called "Combined" in the action set "Mike's Actions"... change the appropriate part to suit your needs.

BUT, and it's a big but, I get a "Server Busy" message pop up after about 5 seconds (while the action is running in Photoshop)... you can just dismiss it by selecting "Switch To", and the script carries on beatifully.

However, I want this to execute like a batch process, processing many selected images, and so I don't want to be there all the time clicking on "Switch To".

Any ideas? A google search has come up with many who have the same problem, but the only solution I've seen relates to Visual C++.

I'm stuck...

Anyway, here is the code:


Code:
' Author: Mike Brewer


Option Explicit

Const kMsgBoxTitle = "iView MediaPro"
 
If (MsgBox("This script opens each selected media item in turn, opens it into Photoshop, and runs the Combined action on it", 65, kMsgBoxTitle) = vbOk) Then
   Main()
End If

Sub Main()

   Dim IViewApp, PhotoshopApp, Cat, mediaItem

   Set IViewApp = CreateObject("iView.Application")
   Set PhotoshopApp = CreateObject("Photoshop.Application")

   If (IViewApp.Catalogs.count = 0) Then
      MsgBox "Please launch Iview MediaPro.", vbCritical, kMsgBoxTitle
   End If

   Set Cat = IViewApp.ActiveCatalog

   If (Cat.Selection.Count = 0) Then
      MsgBox "You need to select at least one media item in the active catalog in order to use this script.", vbCritical, kMsgBoxTitle
   Else
      For Each mediaItem In Cat.Selection
         PhotoshopApp.Open mediaItem.Path
         PhotoshopApp.DoAction "Combined", "Mike's Actions"
      Next

      MsgBox "Finished"
   End If
End Sub



Mike
Back to top
View user's profile Send private message
roberte



Joined: 18 Jun 2004
Posts: 2147
Location: Sydney, Australia

PostPosted: Thu Dec 15, 2005 7:18 am    Post subject: Reply with quote

Hi Mike,

I get a "Server Busy" message pop up after about 5 seconds (while the action is running in Photoshop)... you can just dismiss it by selecting "Switch To"

I get this same warning when sending multiple images to ACR2. iView seems to think Photoshop CS hasn't received the files until they all open up in Photoshop proper. Other apps do the same. No such problem in Photoshop CS2+ACR3 with its ability to handle multiple RAW files.

Surely iView could be made smarter in this regard, especially for VB scripting. Maybe send in a User Suggestion in case no-one from iView reads this.

Thanks for the script.

-- Robert.
Back to top
View user's profile Send private message Visit poster's website
drmrbrewer



Joined: 24 Sep 2005
Posts: 510
Location: UK

PostPosted: Thu Dec 15, 2005 12:52 pm    Post subject: Reply with quote

Hi Robert,

I'm glad it's not only me. I'm still trying to figure out a scripting solution that avoids the pesky Server Bust message, with the help of a certain London-based photographer, author... etc etc, as well as the ever-brilliant Xbytor (he who can code up a script to perform a task of any complexity using only a single expression).

In the meantime, it seems that if you select multiple images in iView and just drag them onto the droplet icon outside iView, then the images are all opened up and processed by the PS action/script in an orderly fashion. At least for me. And that's all I really wanted to achieve with the script below (or is it above? who knows anymore). It's when you select Open With -> Droplet from iView that things go hay-wire with multiple selected items.

I'd still like to find a solution that avoids dragging and dropping --- mainly because I'm too lazy to have to find an icon outside iView and drag stuff to it (and there's the danger of dropping it all in the wrong place by mistake!).

I'll post back if we work anything out. Otherwise at least there is drag-and-drop.

Mike
Back to top
View user's profile Send private message
drmrbrewer



Joined: 24 Sep 2005
Posts: 510
Location: UK

PostPosted: Wed Dec 28, 2005 9:58 pm    Post subject: Reply with quote

drmrbrewer wrote:
In the meantime, it seems that if you select multiple images in iView and just drag them onto the droplet icon outside iView, then the images are all opened up and processed by the PS action/script in an orderly fashion.


Seems like I'm being thwarted at every turn. It now appears that there is a maximum number of items you can drag onto the droplet. I haven't pinned it down exactly, but 16 was OK and 19 wasn't. With 19 I got some sort of error come up. I'm really not sure why and a little exasperated now. Not much good for batch processing when if you're limited to 16 images at a time. Will have to think of yet another workaround.

Mike
Back to top
View user's profile Send private message
roberte



Joined: 18 Jun 2004
Posts: 2147
Location: Sydney, Australia

PostPosted: Wed Dec 28, 2005 10:05 pm    Post subject: Reply with quote

Hi Mike,

It now appears that there is a maximum number of items you can drag onto the droplet.

As a workaround could you make a droplet or script that calls the Image Processor script? The Image Processor lets you add an action.

-- Robert.
_________________
-- Robert
Expression Media 2 / Windows 8 / Mac OS X 10.10
Back to top
View user's profile Send private message Visit poster's website
drmrbrewer



Joined: 24 Sep 2005
Posts: 510
Location: UK

PostPosted: Wed Dec 28, 2005 10:18 pm    Post subject: Reply with quote

Hi Robert.

roberte wrote:
As a workaround could you make a droplet or script that calls the Image Processor script? The Image Processor lets you add an action.


How do you mean? In MediaPro I am selecting a random bunch of images, not necessarily a whole folder or anything, and then asking that those selected images are processed by the PS droplet (by dragging onto the droplet). Would I not still run into the max item limit with your method? How would the Image Processor script know which images are selected without first dragging them onto the droplet?

It's a wierd error:

"Windows cannot access the specified device, path or file. You may not have appropriate permissions to access the item."

The title of the error dialog is the full path of the droplet. But all files are fully accessible; it just seems to create this error above a certain number of items. Seems like a badly worded error message, unless it has some hidden meaning I'm not getting.

Mike
Back to top
View user's profile Send private message
drmrbrewer



Joined: 24 Sep 2005
Posts: 510
Location: UK

PostPosted: Wed Dec 28, 2005 11:05 pm    Post subject: Reply with quote

One workaround is, I guess, just to drag and drop the files from MediaPro into an empty folder and then do a separate batch process on all images in that folder directly from PS, and then delete all files in that folder when finished (being copies). A bit of extra work. I still don't understand why there is some arbitrary limit on the number of images you can drag and drop onto the droplet, though.

Mike
Back to top
View user's profile Send private message
drmrbrewer



Joined: 24 Sep 2005
Posts: 510
Location: UK

PostPosted: Tue Jan 03, 2006 10:43 pm    Post subject: Reply with quote

An update: the limit I found for dragging from MediaPro onto the droplet is 17 items.

An easy-ish workaround: drag (copy) the items from MediaPro into an empty (temporary) Windows folder outside MediaPro. Then drag those copied files from the Windows folder onto the droplet (or just drag the folder itself onto the droplet). When the droplet has done its stuff, delete the temporary folder.

That seems to work.

Mike
Back to top
View user's profile Send private message
mmmdes



Joined: 05 Nov 2006
Posts: 1

PostPosted: Sun Nov 05, 2006 12:07 pm    Post subject: Nuumber Of Files Limited By Droplets Reply with quote

drmrbrewer,

"Copy" the folder that contains the group of images you want to batch process. Not the individual images.

"Paste" this "Copied" folder onto the droplet.

Watch it work.

You can also "Copy" multiple folders that contain the images you want to batch process. Then "Paste" them onto the Droplet. But it will place all the batched images in the one folder. You then have to resort the batched images into their respective folders.

I've just processed about 600 images in multiple folders in one go. Before I could only batch 19 images at a time.

I know this was posted a year or so ago, but I thought I would put my bit in.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> VB Script All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



  © iView Multimedia Ltd. | All Rights Reserved Privacy Policy | Copyright | Site Map