Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Possible to send files to 3rd party program?

New Here ,
Jan 02, 2009 Jan 02, 2009
I'm trying to add a "Send to Flickr Uploadr" context menu to bridge, but I've hit a snag in getting the files to the Flickr Uploader program. <br /><br />I've tried using openWith(), but i don't think that it does what I want it to do. But the documentation on openWith() is a bit sparse. If openWith() is indeed the wrong method to use, what is correct way, or is this even possible? <br /><br />Thanks.<br /><br />here's what i've got so far...<br /><br />// path to flickr uploader<br />flickrPath = "/C/Program Files/Flickr Uploadr/Flickr Uploadr.exe";<br /><br />// only have 1 instance of each<br />function checkEl(w){<br />> var menuEl = MenuElement.find(w);<br />> if (menuEl != null){<br />> MenuElement.remove(w);<br />> }<br />}<br /><br />// send selected files to flickr uploader<br />function send2Flickr(f){<br />> fName = app.document;<br />> for (i=0; i<fName.selections.length; i++){<br />> files = new Thumbnail(File(fName.selections.path));<br />> files.openWith(flickrPath);<br />> }<br />}<br /><br />// check to see if the menu items exist, and remove and recreate if they do<br />checkEl('send2Flickr');<br /><br />// right click context menu<br />var cntCommand = new MenuElement("command", "Send to Flickr Uploadr", "at the end of Thumbnail", "send2Flickr");<br />cntCommand.onSelect = function (f){<br />> send2Flickr();<br />}
TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2009 Jan 02, 2009
ok, i updated the send2Flickr function to this:<br /><br />>function send2Flickr(f){<br /><br />> fName = app.document;<br /><br />> for (i=0; i<fName.selections.length; i++){<br /><br />> files = new Thumbnail(File(fName.selections.spec));<br /><br />> try{<br /><br />> files.openWith(flickrPath);<br /><br />> } catch (error) {<br /><br />> Window.alert(error);<br /><br />> }<br /><br />>}<br /><br />>}<br /><br />and the error that it is returning is "IOError: File or Folder does not exist", although i'm not sure if it is indicating that the file i've selected in bridge doesn't exist or the external application that i'm pointing to doesn't exist. and obviously, both do exist, i just seem to have a syntax error...i'm just not sure what exactly, and how to fix it...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 02, 2009 Jan 02, 2009
I wonder if this:

flickrPath = "/C/Program Files/Flickr Uploadr/Flickr Uploadr.exe";

should it be?

flickrPath = new File("/C/Program Files/Flickr Uploadr/Flickr Uploadr.exe");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2009 Jan 02, 2009
i just tried your suggestion, and it is still returning the IOError. I think you are right in that the application to be opened needs to be an object, I'm just not sure what object it needs to be.

thanks for the suggestion though.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 02, 2009 Jan 02, 2009
I just tried this and it works.<br />I ran it from Bridge CS3 to tell it to open documents in Photoshop CS4<br /><pre><br />var flickrPath = "C:/Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe";<br><br />var items = app.document.selections;<br><br />for (i=0; i<items.length; i++){ <br><br /> file = items; <br><br /> file.openWith(flickrPath,true); <br><br /> } <br><br /></pre>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 03, 2009 Jan 03, 2009
Thank you so much for your help. It is now working for me as well. the problem was with my formatting of the flickrPath location. for some reason the URI path and the standard windows formatting with backslashes doesn't work, but using forward slashes does work.

now that the basics are done, time to smarten it up with extension recognition and possibly auto-conversion.

thanks again
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 05, 2009 Jan 05, 2009
Not all 3rd party software will respond to the commands Bridge sends it when you do openWith. Off the top of my head I'm not sure if openWith ends up sending a BridgeTalk message or some flavor or operating system or message or event (or both), but if you can get the 3rd Party application to open the file using the Bridge UI's File > Open With menu item, then I'd expect scripting's openWith to work as well.

One workaround you can try is the command line. If the third-party software has a command line interface, then you can try using app.system() to issue the commands. It's possible (on both Mac and Windows), for example, to run the DNG Converter from Bridge this way, and this is how the ExportToJPEG's "Send To Flickr Uploadr-Mac.jsx" sample script runs some AppleScript that tells the Mac Flickr Uploadr to open files. I believe that the Windows Flickr Uploadr has a command line interface, so you might try something like this...

// Make a file Object using the known path to the uploadr
var command = "\"" + uploadr.fsName + "\" \"" + fileToUpload.fsName + "\"";
app.system( command );

Note that you usually have to quote paths to files for this to work all the time. Also note that app.system() will block your script until the command returns. Finally, when I've used app.system() on windows in the past, sometimes a command that seems to work just fine from the windows Console doesn't seem to do anything via app.system(). In those cases I've found that witting out the command to a temporary .bat file and then sending the path to the .bat file to app.system() does work.

I know that I've tried before to run Flickr Uploadr windows this way from Bridge, but it was months ago, and I don't recall all the details. My recollection is that it basically worked, but the user experience was a bit clunky because of the modal behavior and because a Console window appears on the screen as the commands run, and I had to quit the Uploadr manually after upload to move on. If you are a clever windows batch file scripter (I'm not) maybe you can workaround those issues.

-David
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2009 Jan 06, 2009
LATEST
Hi David,

Thanks for your thoughts on this.

Before Paul helped me figure out what I was doing wrong, i played around with app.system(), and i too found it too be too clunky of a solution because of the reasons you mentioned.

But I did get this working with openWith.

If you or anyone else is interested, you can find the script on the flickr forums, linked below.

Send to Flickr Uploadr from Adobe Bridge
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines