[JS,AS,CS3]running javascript in bridge from applescript

Sorry for the cryptic subject description, and you might think this is a bit off topic, but i hope you could shed some light on this.
I need to execute a Javascript in Bridge from an applsecript using an Applescript. Bridge only has one AS command: do javascript with arguments.
My testtude looks like this:
set myJS to "
alert(arguments[0].toString());
alert(arguments[1].toString());
alert(arguments[2].toString());
alert(arguments[3].toString());
alert(arguments[4][0].toString());
set arg1 to 12
set arg2 to "some text"
set arg3 to "'some single quoted text'"
set arg4 to "\"some double quoted text\""
set arg5 to {1, 2, 3, "a", "b", "c"}
tell application "Bridge CS3"
do javascript myJS with arguments {arg1, arg2, arg3, arg4, arg5}
end tell
--tell application "Adobe Photoshop CS3"
-- do javascript myJS with arguments {arg1,arg2,arg3,arg4,arg5}
--end tell
You would expect a series of dialogs to appear with the content of the arguments, but you'll get nothing! If you omit the '[0]', you'll get any numerical value, but all strings, however they are quoted, are ignored.
Strange.
Stranger still is, that if do the exact same thing in Photoshop, it works like a charm and you can pass any kind of data as argument.
Any ideas on what's going on?
Thanks!

Here is my AS script from Xcode project:
Some text is in Russian don't mind it. Most important that this is a
working example.
global myBridgeLabel
on clicked theObject
if name of theObject is "b1" then
  set processName to (StringToUnicode "Начало работы")
  set myBridgeLabel to "Red"
  set myLabel to 1
else if name of theObject is "b2" then
  set processName to (StringToUnicode "Сдано на цв-корр")
  set myBridgeLabel to "Green"
  set myLabel to 2
else if name of theObject is "b3" then
  set processName to (StringToUnicode "Сдано на ДТП")
  set myBridgeLabel to "Yellow"
  set myLabel to 3
else if name of theObject is "b4" then
  set processName to (StringToUnicode "Забрано")
  set myBridgeLabel to "Blue"
  set myLabel to 4
else if name of theObject is "b5" then
  set processName to (StringToUnicode "Пересдано")
  set myBridgeLabel to "Purple"
  set myLabel to 5
end if
tell application "Adobe InDesign CS2"
  set mydocument to active document
  set myDocumentPath to full name of mydocument
  set workerName to "Сервецкий"
  tell metadata preferences of mydocument
   set theDate to current date
   set myWeekday to weekday of theDate as string
   set myDenNedeli to my convertWeekday(myWeekday)
   set myRecord to (processName & "  " & workerName & "  ") & myDenNedeli & " " & text 1 thru -4 of time string of theDate & "
   set myHistory to get property namespace "http://ns.adobe.com/photoshop/1.0/" path "History"
   set property namespace "http://ns.adobe.com/photoshop/1.0/" path "History" value myHistory & myRecord
  end tell
  set myJavaScript to "var myLabel =\"" & myBridgeLabel & "\"; app.activate(); var bt = new BridgeTalk; bt.target = \"bridge\"; myScript = 'app.displayDialogs = \"none\"; var t = new Thumbnail (File (\"" & myDocumentPath & "\")); var mdata = t.metadata; mdata.namespace = \"http://ns.adobe.com/xap/1.0/\"; mdata.Label = \"' + myLabel + '\";'; bt.body = myScript; bt.send();"
  do script myJavaScript language javascript
  tell mydocument to save
end tell
tell application "Finder"
  set myFile to a reference to file myDocumentPath
  set label index of myFile to myLabel
end tell
end clicked
on convertWeekday(myWeekday)
if myWeekday = "Monday" then
  return "Пн"
else if myWeekday = "Tuesday," then
  return "Вторник"
else if myWeekday = "Wednesday" then
  return "Среда"
else if myWeekday = "Thursday" then
  return "Четверг"
else if myWeekday = "Friday" then
  return "Пятница"
else if myWeekday = "Saturday" then
  return "Суббота"
else if myWeekday = "Sunday" then
  return "Воскресенье"
else
  return "N/a"
end if
end convertWeekday

Similar Messages

  • [CS5.1] Javascript functionality removed from Applescript?

    I haven't been able to find any answers with this.. and starting to feel like i'm the only one with the problem. I just finally upgraded from CS2 - thankfully not a whole lot has changed and i've found solutions for converting most of my code, but this one i'm stuck on.
    The do javascript command is clearly listed in the library as valid, so when i compile it's recognized and all, it's just that whenever executed Photoshop gives an error saying, General Photoshop Error occured. This functionality may not be available in this version of Photoshop.
    Help..? They didn't really get rid of it, did they?

    Yes that is the thread that I meant… If you've tried what is suggested there then I don't know any more… I had switched scripting language before this change… How much JavaScript is there, can you put it in an inline string? Does this simple example work for you…
    tell application "Adobe Photoshop CS2"
         tell document 1
            set docName to name
            set docMode to mode as string
              do javascript "alert( arguments[0]+' is '+arguments[1] )" with arguments {docName, docMode}
         end tell
    end tell

  • Run javascript (not in a jsx file) from the command line extendscript

    Hi all,
    I was wondering if anyone knew how to run javascript from the command line in Extendscript (meaning Extendscript would be the target application). I know about the -run command line flag in which allows you to run a .jsx script from the command line but what I'm looking for similar syntax to run a script directly without needing to put it in a file. For example I have tried (obviously unsuccessfully):
    C:\Program Files (x86)\Adobe\Adobe ExtendScript Toolkit CC\ExtendScript Toolkit.exe -run "alert('Hello World');"
    Thanks!

    You might be looking for something like this: javascript - Is it possible to execute JSX scripts from outside ExtendScript? - Stack Overflow
    Although that one is about executing JSX files, the solutions given (Applescript as well as COM/VBScript) can be adapted to simply run a javascript code snippet rather than JSX file because the solutions simply call the Adobe app's Applescript/COM API to "execute javascript" (actually execute ExtendScript technically), and in the solution, they using includes to pull in the JSX file. You'd simply replace the include with actual javascript code snippet inserted in.
    Though this would then require you to run a VBScript, Applescript, or other script (that calls the COM/Applescript API) rather than the ESTK command line option.

  • How to automatically run javascript code from Captivate 3?

    Howdy everyone,
    My company uses a custom webpage to display the finished SWF files generated by Captivate 3.  This page has menu buttons on the side that link to other videos that are related to the video being watched.
    We want to add a little bit of spice to the menu, and highlight the next video in the series after the current SWF has finished playing.
    Now I know that Captivate 3 will launch a Javascript code when either a button is pushed, a text box is used, or a clickbox is activated, but we are looking for a way for Captivate 3 to launch a Javascript code apart from user input.  Any suggestions?

    Hi there
    One of the options you have available when Captivate finishes playing a movie is to Execute JavaScript. Perhaps use that?
    Click Edit > Preferences...
    Cheers... Rick
    Click here for Adobe Certified Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Can't Open iPhoto Library in CS3 Ext or through Bridge

    Does anyone know who to open photos stored in the iPhoto Library without having to first save them to the desktop or some other folder?

    Last link does not work.
    Here's the first page of over 160 hits on
    iphoto:
    Search Results for
    iphoto
    161 matches found
    n Topic name: Can't Open iPhoto Library in CS3 Ext or through Bridge
    Forum name: Photoshop Macintosh - Message #3
    Posted By: mfettig - Mar 29, 2008 02:56 pm
    I search I did before posting my message for iPhoto turned up nothing...
    n Topic name: Can't Open iPhoto Library in CS3 Ext or through Bridge
    Forum name: Photoshop Macintosh - Message #2
    Posted By: Ramón G Castañeda - Mar 29, 2008 02:20 pm
    For instance:
    -macman, "iPhoto & Photoshop" #8, 2 Mar 2008 1:20 pm
    n Topic name: Can't Open iPhoto Library in CS3 Ext or through Bridge
    Forum name: Photoshop Macintosh - Message #1
    Posted By: Ramón G Castañeda - Mar 29, 2008 02:18 pm
    iPhoto buries the images deep inside a package. :/ This question comes up often, but I don't recall anyone giving a straight solution. Do a forum search on
    iPhoto just in case.
    Discussion: Topic name: Can't Open iPhoto Library in CS3 Ext or through Bridge
    Forum name: Photoshop Macintosh
    Posted By: mfettig - Mar 29, 2008 02:56 pm
    Does anyone know who to open photos stored in the iPhoto Library without having to first save them to the desktop or some other folder?
    n Topic name: Lounge Gallery 3
    Forum name: The Photoshop Lounge Basement - Message #909
    Posted By: Phos±four dots - Jul 5, 2007 11:08 am
    Dunno much about Picasa yet, Mizz Lizardie, since I only just rediscovered it about 45 minutes ago. But that first album I created was easy as pie. I downloaded the Google Picasa desktop app for uploading peekchairs, so I have to explore that, too. I a
    n Topic name: com.adobe.mediabrowser.plist
    Forum name: Photoshop Macintosh - Message #12
    Posted By: Joe Sap - Feb 23, 2008 11:33 am
    OK, let me try this again: I am not working over a network. I am working on files stored locally on the internal hard disk. Yet the problem happens only when the file server is mounted (for other reasons, unrelated to Adobe applications - like co
    n Topic name: CS3 Photoshop Printing to a HP DeskJet 5500 PS issue
    Forum name: Photoshop Macintosh - Message #8
    Posted By: Kevin B Gilmore - Jan 14, 2008 12:42 pm
    I have the same issue with both an HP 2800 Business inkjet and Epson 4800 Printer. I can print images from iPhoto and preview just fine. But I can't print out of Adobe without getting the "No %%BoundingBox: comment in header!" Error and then the
    Discussion: Topic name: Online image gallery from local folder structure??
    Forum name: Photoshop Macintosh
    Posted By: Micah Diamond - Mar 24, 2008 10:23 pm
    Does anyone know of a program (ideally for the Mac, but it can also be for Windows) that will allow me to create (and possibly sync) an online web gallery from a specified folder structure of images stored locally on my computer? iPhoto 'sort of' allow
    n Topic name: iPhoto & Photoshop
    Forum name: Photoshop Macintosh - Message #8
    Posted By: -macman - Mar 2, 2008 01:20 pm
    Arlen, take a look at this: http://www.macworld.com/article/50671/2006/05/photobrowser.html I just tried it, and it seems to work pretty slick. iPhoto doesnt even have to be running to use it. Simply drag files from the browser to wherever you choose
    n Topic name: iPhoto & Photoshop
    Forum name: Photoshop Macintosh - Message #7
    Posted By: Tom Murray 1 - Mar 2, 2008 12:30 pm
    I think what he wants, is to be able to browse through photos stored in iPhoto from Photoshop.
    n Topic name: iPhoto & Photoshop
    Forum name: Photoshop Macintosh - Message #6
    Posted By: -macman - Mar 2, 2008 11:30 am
    Arlen, >If anyone has other ideas, please post Can you be more specific about your needs/workflow? Weve shown you several ways to open iPhoto files in Photoshop already. Im curious b why any of those detailed methods fail to suit you. I
    n Topic name: iPhoto & Photoshop
    Forum name: Photoshop Macintosh - Message #4
    Posted By: Arlen Nagata - Mar 2, 2008 10:52 am
    Thanks -macman & Nani, I was hoping for a better solution. Yes I can export all my photos, but that defeats the purpose of using iPhoto to organize them. And yes I can find the originals with show in finder, but it's a bit tedious. I think
    n Topic name: iPhoto & Photoshop
    Forum name: Photoshop Macintosh - Message #2
    Posted By: -macman - Mar 2, 2008 01:35 am
    >I'm using iPhoto to manage my photos, but I can't access the pictures in photoshop. Correct. In the past, too many users were caught messing around in iPhotos library, thus causing endless corruption problems within the app. Apple decided to disco
    n Topic name: iPhoto & Photoshop
    Forum name: Photoshop Macintosh - Message #1
    Posted By: Ramón G Castañeda - Mar 2, 2008 12:17 am
    Forget about what you have "imported into" iPhoto. Open the originals.
    Discussion: Topic name: iPhoto & Photoshop
    Forum name: Photoshop Macintosh
    Posted By: Arlen Nagata - Mar 23, 2008 06:50 am
    I'm using iPhoto to manage my photos, but I can't access the pictures in photoshop. What do I do? The closest thing I've found is in iPhoto I changed the "Preferences" of edit to open Photoshop. Is there another solution to integrat
    Click on the SEARCH button to bring up more results
    back to top

  • Run BI Publisher report from an application directly to  a printer.

    Dear All,
    I have an HTML page (with JavaScripts),
    I want to Run BI Publisher report from this page directly to a printer. (and send parameters).
    Can anyone help me, and send me Demo URL or Demo code to do this?
    Regards,
    Tovit

    Tovit
    you are going to have build out a servlet that the page can call. The servlet will need to implement the supported web services to schedule a report. The schedule can include the delivery options ie to a printer. So you would create a schedule that runs the report immediately via the scheduler and then to the printer.
    I dont currently have any servlet demos but the services are pretty well covered in the user docs.
    check them out and give it a try, if you get stuck let me know
    Tim

  • Is there a way to run javascript in the url in FF6?

    With the introduction of scratchpad to FF6 the javascript in the url is filtered out and will not execute.
    The only way i have been able to run js scripts is to use the scratchpad even if it's a one line thing that i need.
    I went into about:config and typed javascript into the filter then changed the browser.urlbar.filter.javascript configuration from true to false, nothing changed.

    Running javascript: in the urlbar is no longer supported in version 6 for security reasons. Users were installing malware. Please use the scratchpad.

  • Is there an easy way to run an Ajax function from input type=file to test the file name in DB?

    I've had the <input type="file">  ... <cffile ...> thing going for a few years now. 
    There is a database where the uploaded file names are stored once the files are uploaded to the server.  It sees things in terms of problems and stores uploaded file name accordingly with the ProbID prepended onto the file name; e.g., MyPicture.jpg would end up in the designated directory and databawe as P416_MyPicture.jpg.  This allows user to store pictures with the same name in different problems without a conflict.  There has been an issue with certain characters (e.g., spaces, +, #, etc.) causing problems when they are in file names so we have come up with a way using the <cffile ... rename> to replace these chars with _.  This means that MyPic+.jpg would end up being P416_MyPic_.jpg. 
         This is where the problem appears.  If someone were to upload MyPic+.jpg after someone else uploaded MyPic_.jpg in the same problem, then the + file would overwrite the _ file before the system knew they had a problem.  And there is now way to restore the original file without going to the system backup and doing so – which is a whole other story … especially, if the person doesn’t tell anyone.
         The logical solution would be to be able to test the new final file name (the name after making the substitutions mentioned above) against the existing files in the database before you went from the page where the <input type=file> control to the associated _action.cfm page where the <cffile> object is located.  Given that this seems to be the province of Ajax, this would seem like a natural use of the really interesting technology.  I have can determine the file name from the onChange action on the <input type=File> so that this would be the place for Ajax to come to the rescue by looking up the final file name and then letting the user know whether the resultant name is a unique within the database or not.  If so, I'll just enable the Add button which sets right next to the <input > control and let them upload it.  If not, I'll put up an error message telling them that this file already exists in the system.
         This would be the perfect solution.  It would let me do some Ajax stuff like I've wanted to do for the past year, but never have had the time to do because this is the project that won't go away.  This is, in fact, the last thing of any consequence that remains to do on this 2-1/2 year nightmare – be careful what you wish for.  If I can get this done this week, then maybe I can finally take a weekend off … maybe it will finally come to an end.
         Which finally leads to my question:  I'm looking for some tips on how to get this thing going since I can barely spell Ajax.  I've got a book and looked at some stuff online about CF and Ajax, but a good example or two or three would be worth a day's worth of poking around on the web and in my books.
         Thanks in advance for any suggestions, ideas, help, whatever.
    Len

    Adam,
         Thank you for your suggestion, but, after spending the night working with Ben Forta's CF8, vol 2, Chap 34, working with <cfajaxproxy>, I was able to do exactly what I wanted and it appears, after some testing, to work exactly as I had envisoned it should. 
         I am now calling a JavaScript function (testFileName) from the onChage event on the <input type="file"> or Browse button, which calls my proxy.cfc that contains the server side of the equation.  This funciton testFileName (I've run out of cleaver function/file names).  The query contained therein hits the database to see if the passed in parameters can pull up an existing file.  If they do, the particulars (file name, data attahced, etc.) are returned to the JavaScipt procedure that puts up the error notice.  The user can then chose to either overwrite the file or quit.  Quiting leaves the your on the Attachment PopUp where he/she started with nothing being uploaded. 
         Thanks again for your suggestion.  I appreciate your taking the time to do so.
    Len

  • Running a java applet from flash

    Hi,
    How do you run a java applet from within a Flash movie?
    Is it necessary for the user to download a java interpreter, or is there an interpreter somehow built into their browser that can run applets?

    I was wondering , I don't know too much about Flash
    I remember seeing some classes in amongst the Flash
    files when it installed , but couldn't tell you whart they
    do (at the moment , but you've got me interested)
    maybe you should rethink your strategy for building your page (and your movie) maybe build the movie around
    your applet , or preload it then replace a an area of your movie area with your applet (the way you handle rollovers).
    the advantage is you can make calls to applet methods
    from Flash as it supports Javascript.
    jus remember to set the scriptable <PARAM> to true
    Users shouldn't have to download the plug-in or JRE
    you should specify it in the OBJECT or EMBED tag so
    if they don't have it , the browser will tell them.
    of course this is going to change as Microsoft are stopping support for JAVA , users will then have to download the plug-in from Sun in order to view or use JAVA on the internet.

  • Get error message when trying to launch bridge from CC 64 bit.

    Get error message when trying to launch Bridge from Photoshop CC 64 bit.  "Cannot complete command because extension cannot be loaded."  Need fix.  Thanks.

    Hi Adobe Bubba,
    Please uninstall the software, run the cleaner tool, restart your machine and install again.
    Cleaner tool: http://www.adobe.com/support/contact/cscleanertool.html .
    Regards,
    Romt Sinha

  • Why can I no longer open images with Photoshop CS3, running on Mac OS 10.4.11?

    Why can I no longer open images with Photoshop CS3, running on Mac OS 10.4.11?

    You may be able to drag and drop the icons from one toolbar onto another, you can then hide the toolbar that you no longer need. For details on how to do that see https://support.mozilla.com/kb/How+to+customize+the+toolbar

  • Adobe CS3 Extended - problem w Bridge - picture displayed wrong in Horrizontal Filmstrip mode

    Recently started have problems with Adobe Bridge (CS3 Extended) after it did an automatic update from Adobe for my CS3. The problem is that the panel where the picture appears in "Horrizontal Filmstrip" is now positioned to the far right - partially off the screen; plus, whatever action done previously is showing through the panel area where the picture should have been. Doing "refresh" does not help.
    Tried to reinstall the whole program but the problem did not go away.  Then uninstalled the whole Adobe CS3 suite (which includes Bridge); then reloaded the probram; and, then the problem went away. As soon as I downloaded the updates from Adobe again, the problem reappeared. Anyone no what to do?

    Did you try to reset the preferences by holding down the ctrl key and starting Bridge?   You will get a reset window, choose all 3 options.
    A re-install will not affect this file so if contaminated before it will be contaminated after.
    Also, make sure you have the latest video driver, as this affects the filmstrip mode.

  • Feed Bridge from Access or Excel speadsheet??

    Hi -
    This is a Bridge question so I hope I'm in the best forum for an answer.
    I have a huge image database (3000+) in MS Access.  My supervisor wants to customize it.  By the time he was finished describing his wish list it sounded like he wanted to re-invent adobe Bridge.  So I demonstrated how we can open the folders of images, display, make collections and keyword, etc.  So far so good- until he reminds us that there are image attributes (column headings in an Access table) that we would have to enter by hand.  Yikes!
    Is there a way to automate Bridge so that these attributes are filled in as keywords to their respective images?
    I can get Access to output the table as Excel spreadsheet or CSV list.  Will that help?
    Am I on track or does Bridge lack the functionality to handle being fed by a db or spreadsheet?
    TIA some input.
    JL

    To run scripts for bridge, there are a couple of ways.
    1. Run the script from ExtendScript Toolkit, this gets installed at the same time as Photoshop and can be found:-
    C:\Program Files\Adobe\Adobe Utilities
    2. Run the script from Bridge itself, the problem here is that the script must be written so that it has a menu element scripted within it else the script will just run every time Bridge is opened.
    To install a script in Bridge:-
    Edit - Preferences - Startup Scripts
    At the bottom click the "Reveal Button" this will open the folder where the script should be saved.
    Close and restart Bridge.
    Accept the new script.

  • Unable to run JavaScript via Console in Acro Pro 8.2.2 - security issue?

    I'm unable to run a JavaScript either from the Console or via AppleScript's do script.
    At first I thought it was a keyboard issue as I'm using a MacBook Pro, but fn-Return for Enter works in Acrobat 7.1.0 Console.
    Trying to run a JavaScript from AppleScript with do script returns 'Adobe Acrobat Professional got an error: can't continue do script'
    The various preferences are:
    JavaScript
    Enable Acrobat JavaScript yes
    Enable menu items JavaScript execution privileges yes
    Enable global object security policy no
    Enable JavaScript Debugger after Acrobat is started yes
    Enable interactive console yes
    Show console on errors and messages yes
    Security (Enhanced)
    Enable Enhanced security no
    I think these settings should enable JavaScript to be run from the Console, but I'm getting the impression that the latest security fix is locking down JavaScript despite these settings.
    I'm on a MacBook Pro running Mac OS X 10.5.8
    Has anyone else seen anything like this? Looks like I'll be going back to 7.1.0 for a while.
    MTIA
    David    

    Thanks. I've copied the thread over.
    David

  • Running JavaScript

    I need to change the the function of the share button in Acrobat reader X .. is there any function like Doc/WillPrint or Doc/WillSave for the share option??
    And is there any way to run the JavaScript in Actions tab under page properties in Acrobat reader X 10.1.1 ? I Have come across this screen shot of page properties while browsing to get an idea to do that soo.. please help me with your views on this.. thanks in advance.

    The only way to change that function would be a custom plugin (in C/C++).
    Page Actions will run in Reader – but you need Adobe Acrobat in order to author them.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Thu, 26 Jan 2012 08:17:42 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Running JavaScript
    Running JavaScript
    created by avykasa<http://forums.adobe.com/people/avykasa> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4166648#4166648

Maybe you are looking for

  • Aging report logic

    Hi, There is an requirement where i need to generate report on aging.. ie.. amount unpaid by the customer to be identified on different aging 0-15 days 16-30 days 31-45 days 56-90 days so the output of the report show be like above on different again

  • Can Preview be made to offer a Presenter Display much as Keynote?

    When in "play" mode, Keynote offers a highly valued feature known as +Presenter Display+ that shows the current plus the next presentation slide on the computer screen side by side while, at the same time, driving a beamer connected to the display po

  • Rendering not right until refresh

    Hi, With some of my components, things don't look good until a resize of the container occurs. For example, my custom table column sizing will be messed up. I'll move the bounds of the window 1 pixel, and everything 'snaps' into place. Is there a way

  • Interpret Footage works fine in pre8 but NOT pre9

    I use pre8 at work - use Interpret Footage all the time to Conform to - PAL widescreen. It works fine. No problems. I have just purchased pre9 for use at home. Interpret Footage does NOT work. The video fails and the audio fails. Not good. Problem. I

  • Additional rows in InfoSet extract (SQ02)

    I am trying to build an InfoSet with custom code to read the classification values for materials, using MARA as a base table. For each record from MARA, I am reading the classification for the material using function module CLAF_CLASSIFICATION_OF_OBJ