Scripting via estk

Hello,
What i am trying to do is generate a jpg image from an ai file(not a drawing, but a library = not possible to open in pdf) shown in bridge.
I have my script, it is working correct when executing this in estk.
And if i understand correct, i need to create an object of illustrator in order to execute the script in my vb.net program. But, because this script has nothing to do with illustrator in general i was wondering if it is also posible to create an object of the estk program and execute the script in the background with this object instead of illustrator?
Thanks
Also another question:
When ran from vb.net, it goes in debug.
#target bridge
#targetengine "MainEngine"
function SnpCreateThumbInspectorPanel()
    try
        this.requiredContext = "\tExecute against Bridge main engine.\nBridge must be running.";
        $.level = 1; // Debugging level
        this.panelRef = null;
        //alert(arguments[0]);
        Folder("c:\\temp\\illustratorcentraliser").create();
        //LINE 17 HERE
        var loc = new Thumbnail(Folder("/C"));
        loc.open();
        this.t = new Thumbnail(File("/c/00_sym.ai"));
        app.document.select(this.t);
    catch(e) {
        alert( e + ":" + e.line );
SnpCreateThumbInspectorPanel.prototype.run = function()
    if(!this.canRun())
        return false;
    var bmd = new BitmapData(this.t.spec);
    if(bmd instanceof BitmapData)
        var expPath = "C:\\temp\\illustratorcentraliser\\" + this.t.name + ".jpg";
        bmd.exportTo(new File(expPath));
        return true;
    $.writeln("ERROR:: Cannot render thumb");
    return false;
SnpCreateThumbInspectorPanel.prototype.canRun = function()
    if(BridgeTalk.appName == "bridge") { return true; }
    $.writeln("ERROR:: Cannot render thumb");
    $.writeln(this.requiredContext);
    return false;
if(typeof(SnpCreateThumbInspectorPanel_unitTest)  == "undefined") {
    new SnpCreateThumbInspectorPanel().run();
it says
Script Alert
ReferenceError: Thumbnail does not have a constructor:17
OK  
the code i am using in vb.net is
dim illy as illustrator.application = CreateObject("Illustrator.Application")
illy.DoJavaScriptFile("C:\previewSelectedLibrary.jsx")
Message was edited by: abjelly

ok this is the end result for if someone should be searching for this...
Thanks.
Script that extracts thumbnail image from a given .ai drawing/library file in bridge
@arg0 = path to let bridge navigate to where the ai resides example /C/temp/
@arg1 = actual ai image path example /C/temp/img.ai
@result: jpg image is exported to expPath
#target illustrator
function script(){
    try
            Folder("/c/temp/illustratorcentraliser").create();
            var loc = new Thumbnail(Folder(_sourceFolder));
            loc.open();
            var t = new Thumbnail(File(_sourceFile));
            app.document.select(t);
            var bmd = new BitmapData(t.spec);
            if(bmd instanceof BitmapData)
                var expPath = "/C/temp/illustratorcentraliser/" + t.name + ".jpg";
                bmd.exportTo(new File(expPath));
    catch(e) {
        alert( e + ":" + e.line );
var bt = new BridgeTalk();
bt.target = "bridge";
var theScript = "var _sourceFolder = " + "" + arguments[0].toSource() + "" + "; ";
theScript += "var _sourceFile = " + "" + arguments[1].toSource() + "" + "; ";
theScript += "var BridgeScript = " + script.toSource() + "; BridgeScript(); ";
bt.body = theScript
bt.send(4);

Similar Messages

  • How to call a shell script via ODI

    Hi,
    I need suggestion on following issues:
    1) How to call a shell script via ODI?.. I tried using OSCommand utility .inspite of the execution being successful the data is not written into the new file in the desired format. After processing new file is created in the mentioned location but its empty.
    2) I'm calling a procedure in ODI to load data into my fact. But once the fact gets loaded i want to update the log details (num of rows processed,num of rows inserted,num of rows rejected etc) in my log table. I'm planning to use a proc for updating but need to know from where can i find these details. Is there a table in work rep which gives me these info like how we get if we execute an interface.?
    Please help me out.. Its urgent
    Regards
    Surabhi

    Hello,
    Question 1 appears a little vague, please elaborate. If you're looking to capture a return value from the command execution, you will need to pipe the return value to a file, then read from there.
    The execution information is stored in the SNP_STEP_LOG table in the Work Repository. You will need to do a series of joins to retrieve the exact table that was updated. Good luck with this...

  • Error while trying to add a SQL Script via DB02

    Good Morning and happy Sysadmin day to everyone,
    I have the following Problem regarding DB2 9.5
    I'm trying to run a SQL Script via DB02 in an ERP 6.0 System.
    I'm using DB02 -> Jobs -> SQL Script Maintenenace -> Add
    Then there is a Textfield "Script Name". When i'm using the F4-Help I'm getting the following error Message:
    List box value range for field DYN_SED-SCRIPT_NAME could not be created
    Message no. DB6PM004
    Any suggestions what might be the Error?
    Thanks in Advance
    Marco

    Are you trying to create a new Model or trying to import a Model ?

  • How to change maintenance powershell script via GPO?

    Per suggestion reposted from here: http://social.technet.microsoft.com/Forums/windowsserver/en-US/6eece9d6-a524-48aa-8e64-7554f0ec9b31/how-to-change-maintenance-powershell-script-via-gpo?forum=winserverGP
    Posted at http://answers.microsoft.com/en-us/windows/forum/windows_7-desktop/desktop-shortcuts-to-items-on-network-drives/94eddb27-342b-40fc-9ad4-677ff4ee8ebe?page=9&tm=1403700614489 originally.
    There is a very annoying "feature" in Windows 7 called BrokenShortcuts.ps1 which is being called out weekly via maintenance task and if it finds more than 4 "broken" network shortcuts it removes them all. So it means if a user at this
    moment is disconnected from the network he will lose all links to shares, network applications sitting on his desktop. Funny that there was no such script on Vista and i don't see this on Win8. On the post i have attached one user suggested to edit this script
    and change 4 to 500 or whatever high number. That's fine for one time fix. But i need to do this for 200+ users. This file cannot be simply replaced by a script, so i'm wondering is there any way to do it via GPO?
    I have already tried various startup scripts, but i'm not sure which user to put into commands.
    I need to run this on startup:
    takeown /F C:\Windows\diagnostics\scheduled\Maintenance\TS_BrokenShortcuts.ps1
    icacls c:\windows\diagnostics\scheduled\maintenance\TS_BrokenShortcuts.ps1 /grant "some user":F
    copy \\share\folder$\TS_BrokenShortcuts.ps1 C:\Windows\diagnostics\scheduled\Maintenance\ /Y

    You need to take time to study how Windows does these things.  You can control them with GP which is what you asked.  The article shows you how to disable elements of the tasks.  Each task controls a script.  If you disable the task the
    script that deletes shortcuts will be stopped. Other maintenance tasks will continue to run.
    Most of your problem is that you seem to want someone to provide a magical solution.  In technology it is necessary to fully research your issues until you understand all aspects.  After fully studying the issue you should understand the possible
    solutions if they exist.
    You claim to have deployed the patch that Microsoft released to fix the issue.  You claim it didn't work.  If that is the case then you need to call MS and \p[en a support incident.  If  Microsoft determines that you are right about the
    patch not working you will not be charged for the call.
    I know that learning how to support technology is hard and frustrating for newcomers.  In time, by using these incidents to learn, you will become a seasoned technician and all of this will seem trivial.  Until then we can only suggest that you
    do things that most of us are familiar with.  We cannot fix your network for you.
    I think you haven't really posted in the GP forum but posted a question about GP in the server forum.  Try posting in the GP forum.
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverGP
    Here is one answer from the GP forum:
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverGP
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/600ca14f-8b1b-400c-b27f-a7f5733407ac/windows-scheduled-maintenance-task?forum=winserverGP
    ¯\_(ツ)_/¯

  • Edit Cluster Start-stop- and Monitor-Scripts via Bash?

    Hi,
    is there a way to edit (and sync!) the Cluster-Scripts via CLI?
    Regards
    Bernd

    The short answer is no. The scripts are stored in eDir, and NCS keeps revisions of them internally. The best place to edit them is iManager. Alternatively, you can directly change the eDir attributes for those scripts while cluster is down.
    That said, everything that iManager does comes in through a file interface. If you goal is to script resource modification, you can always access the file interface directly.
    Regards,
    Changju
    Originally Posted by toblerone
    Hi,
    is there a way to edit (and sync!) the Cluster-Scripts via CLI?
    Regards
    Bernd

  • View procedure scripts via catalog

    I have a suggestion for future implementation of Oracle CATALOG:
    It would be useful to see the procedures scripts via a kind of ALLPROCEDURES view, to make it easy to explore the relationships among functions and procedures and tables - well, to trace the plan of the application you're working at.
    I'm sure these data are already somewhere in the catalog (that's what "stored" procedure is supposed to mean), so it should not require a big effort by Oracle, but it would greatly benefical for development pourposes.
    Am I wrong?

    Actually DBA_SOURCE is containing only the stored procedures, functions and packages sorces. In order to find the relations between functions and tables for example you should use DBA_DEPENDENCIES.

  • Trying to deploy a VB Script via sccm 2012 R2

    Hello All
    This is my first attempt at deploying a script via SCCM 2012 R2 and I seem to be stuck. Essentially what this script does is map a printer. The script on its own works fine. Meaning it works when I double click it and also running it from the command
    line. Its  when I try to use in sccm things go down hill. I have tried the following from the command line in the package properties.
    \\my-sccm-server\Sources\Applications\VBSripts\cscript.exe Impact.vbs
    \\my-sccm-server\Sources\Applications\VBSripts\Impact.vbs 
    Phil Balderos

    looks good :)
    You can check execmgr.log on the client to monitor the install as it is running.
    Thank Richk,
    Still no luck. Here is the output from execmgr.log. Its saying that is completed but nothing ever happens. I am about ready to throw in the towel on this one but I just feel like that is should work because its such a simple script.
    Set WshNetwork = CreateObject("WScript.Network")
    WshNetwork.AddWindowsPrinterConnection "\\srv-gtt-papercut\followme"
    WshNetwork.SetDefaultPrinter "\\srv-gtt-papercut\followme"
    Phil Balderos
    Is the script running as an Admin ,if so then you likely set the printer up for the local system user account and not anyone else.
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • Execute photoshop script via illustrator cs5

    Hi
    Is it possible to execute Photoshop script via illustrator
    I have 2 different script
    script 1 work in illustrator with eps file and export as jpeg
    script 2 where i want to trim the exported jpeg for illustrator in photoshop and save it back
    I have 2 differnt script with me
    can anyone help me to club both and run at same time..
    Thank you
    Appu

    use BridgeTalk to have Illustrator talk to Photoshop, here's a sample by Mark
    Illustrator script to open file in Photoshop
    or use inter app communication
    open PS, open a document
    // start your illustrator script
    var Aidoc = app.activeDocument;
    continue with your script
    // when ready, call your photoshop script
    // this sample alerts the active document name and closes it
    photoshop.executeScript("alert('document name: ' + app.activeDocument.name); app.activeDocument.close()");

  • Sending Script via Email

    Hi Folks,
                 I am able to send Script via mail to yahoo id with PDF attachment but not able to recieve the pdf attachment in gmail i.e. I get the mail in gmail but not with PDF attachment.
    Well in scot the output type is PDF.
    Thanks for responses in Advance
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Feb 4, 2009 9:24 AM

    Hi,
    check below links,
    /people/erwan.lebrun/blog/2007/04/16/tips-tricks-email-fax-through-the-same-output-type
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/mail%2bsend%2bthrough%2boutput%2bcontrols
    Regards,
    Madhu

  • Executing powershell script via task scheduler

    Hello,
    I am trying to execute powershell script via windows task scheduler which will forcefully delete all email in a mailbox, but I am getting the below errors
    Operational Code - 2
    Task Category - Action Completed --- Task Scheduler successfully completed task "\IL98" , instance "{2b193375-cbd2-4986-918d-3cfd4027d6b6}" , action "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" with return code 0.
    Last Run Result - 0X0
    When I am adding additional cmdlets in the script "Set-ExecutionPolicy Unrestricted", I am getting Last Run Result 0X5 rest of the error remains the same.
    Powershell version - 3.0
    Task Scheduler version - 1.0
    If I try to run the script manually via Exchange Powershell the script executes without any errors
    Thanks in Advance,
    Ankush Shah

    I figured out the problem, there wasn't any problem with the script but I had to correct inputs in windows task scheuler
    Below is the resolution:
    Under Actions:
        Program/Script --> ws\System32\WindowsPowerShell\v1.0\powershell.exe
        Add Argument --> -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto
    ; <filepath>"
    Eariler I was writing the filepath after double quote "
    Also I have selected the option "Run with Highest Privilages" to avoid
    0x5 error

  • Executing PowerShell script via JAVA

    Hi,
    I have simple powershell script as below :
    # Filename: Hello.ps1
    Write-Host
    Write-Host 'Hello World!'
    Write-Host "Good-bye World! `n"
    # end of script
    I wish to run this script via JAVA by the below JAVA code -
    import java.io.*;
    public class PsJava {
    public static void main(String[] args)
    throws IOException{
            Runtime runtime = Runtime.getRuntime();
    String cmds = (String)
    "cmd /C powershell C:/Documents and Settings/vvenkata/My         Documents/Hello.ps1";
            Process proc = runtime.exec(cmds);
            proc.getOutputStream().close();
            InputStream inputstream = proc.getInputStream();
                InputStreamReader inputstreamreader =
    new InputStreamReader(inputstream);
                BufferedReader bufferedreader =
    new BufferedReader(inputstreamreader);
    String line;
    while ((line = bufferedreader.readLine()) != null) {
                System.out.println(line);          
    Thanks
    Now, why is that I am not able to see any print statements from Hello.ps1 ? Can anyone help me on this?

    Hi,
    I have place my powershell script in the 'C' directory. and i have changed my JAVA code as below, but it still doesn't give any output in my Eclipse Console.
    import java.io.*;
    public class PsJava {
    public static void main(String[] args)
    throws IOException{
            Runtime runtime = Runtime.getRuntime();
    String cmds = (String)
    "cmd /c powershell c:/Hello.ps1";
            Process proc = runtime.exec(cmds);
            proc.getOutputStream().close();
            InputStream inputstream = proc.getInputStream();
                InputStreamReader inputstreamreader =
    new InputStreamReader(inputstream);
                BufferedReader bufferedreader =
    new BufferedReader(inputstreamreader);
    String line;
    while ((line = bufferedreader.readLine()) != null) {
                System.out.println(line);          
    Please advice me on this. If I have to create a batch file, then can you let me know how do I do that?
    Thanks

  • Actions loaded in script via in illustrator

    Dear Friend,
    i am having some actions(*.aia), those actions loaded in script via in illustrator. please help me.
    By,
    Seenuvasaragavan B

    help with what?
    You have not described any issues.
    Be aware, there's a bug in Ai which removes all scripts within actions as soon as Illustrator quits (exits). Actions will not retain script steps.

  • IDCS5-win. Error while running a script from indesign(not via estk)

    Hi all,
    After running the script from indesign, I get following error
    ASSERT '(engine->getDebugFlags() & ScScript::kExtendedErrors) == ScScript::kExtendedErrors' in ..\..\..\source\components\script\javascript\JavaScriptRunner.cpp at line 412 failed.
    ..\..\..\source\components\script\javascript\JavaScriptRunner.cpp (412)
    any idea about this?
    The script runs fine when run from ES tool kit.
    Thanks

    Hi,
    My colleague found the problem. We were using extendables library and we still haven't figured out what was actually happening, but removing it solved the problem.

  • Open script in ESTK by using a script.

    I am trying to make a command to open a chosen .jsx file inside the ESTK.  I was trying to make an applescript string to be written and immediately executed with file.execute() (.scpt extension), but my file.execute() just opens the string up in an applescript editor, which I can compile and run from the editor and the script does work (sort of*).  *meaning, it pops up the trust dialog if there's a #target illustrator in the document.
    Anyways, I was looking to do the exact same thing as a Windows counterpart which I've already tested, where a .vbs file constructed thus, would work exactly as desired, opening up a .jsx file in the ESTK by doing a shell script object command in the .vbs.

    I was able to create the next-best-thing , which is a bundled .app applescript file, saved from an applescript editor, which I put to live in the application scripts folder.  The .app file is like .jsx or .vbs files because it will work when double-clicked, or performed file.execute() on.  That file is set up to run a .scpt file of a constant name, which I write into the same folder, so by changing the contents of my .scpt file, this more awkward system is a bit more helpful on the Mac.  The problems are that the warning yes/no dialog box pops up for files with "#target" in them, and that scripts sitting inside the Adobe Scripts folder do not even open. This is the applescript example:
    do shell script "open -a \"ExtendScript Toolkit\" \"/Users/me/myFile.jsx\""
    There's probably a much better way to do this, is there?

  • After using an ExtendScript (via ESTK) Illustrator becomes corrupted and "Can't open illustration."

    Hey, thanks for reading.
    I'm having a strange problem with Illustrator CS5 and ESTK CS5. I'm new to writing ExtendScripts, so I haven't a clue what could be going wrong here but here's the skinny:
    I've written the following code, which is very specialized to the exact document I'm working with. Using the ExtendScript Toolkit, the script goes through the following loops:
    The primary problem:
    For some reason, running this script causes Illustrator to become somehow corrupted. I can continue working with the document as long as it is open, but if I try to close it and re-open it, I get the infuriatingly unhelpful error dialog "Can't open illustration." With no extra details.
    The same error comes up if I try to open any other .ai files. Shutting down and rebooting doesn't fix the problem. I have to completely uninstall Illustrator, then re-install it before it will work again. And even then, if I try to open the ExtendScript-corrupted file the whole Illustrator app gets corrupted and needs to be reinstalled.
    Oh, also Illustrator itself shows up as "(Not responding)" while the script is running, but the ESTK console clearly shows that the script is chugging along as expected.
    Specifics about the script:
    There are 4 "Buttons" on the document, and a library full of nearly-identical symbols in the Library (different colored backgrounds for the buttons).
    The script cycles through every symbol in the library, replacing and deleting instances of the previous symbol.
    Then, for each symbol, it cycles through an array (technically an object-literal) of { language-code: "string" } pairs, and saves a .png of each artboard for each word.
    What follows is a pared-down version of the full script:
    (I tried to add a few $.sleep(10); calls, hoping that maybe just a brief slowdown in the processes might help. It didn't.)
    This script (in its original form) outputs a ton of files very, very quickly.
    Script Example
    var folder = Folder.selectDialog();                     // Ask for a folder choice.
    var aDoc = app.activeDocument;                        // Declare an active Document reference.
    var textLayer = aDoc.layers.getByName('text');   // Get the text layer, for moving it back/forward
    var textFrms = aDoc.textFrames;                       // Get all text frames, for language swap
    var allSymbols = aDoc.symbols;                         // Get array of all symbols in the symbol library
    var allSymbolItems = aDoc.symbolItems;            // Get an array of all symbol instances in the active document
    var helpTextArray =
        en: "help",
        az: "Kömək",
        cs: "Nápověda",
        da: "Hjælp",
        de: "hilfe",
        el: "Bοήθεια",
        en: "help",
        es: "ayuda",
            * There's normally 3 arrays with many more languages / translations
    if( aDoc &&                                      // We have an activeDocument
         folder &&                                    // and we have a selected output folder
         allSymbols.length > 0 &&             // We've got symbols
         allSymbolItems.length > 0 &&      // and we've got symbol instances "symbolItems"
         textFrms.length > 0 ) {                 // and we've got textFrames to manipulate.
        // For each symbol in our symbol library...
        for(var i = 0; i < allSymbols.length; i++) {
            // Run through all instances of symbols (symbolItems), and replace with a different symbol.
            for(var ii = 0; ii < allSymbolItems.length; ii++) {
                // Move text layer out of the line of fire.
                $.writeln('Move text to back');
                textLayer.zOrder(ZOrderMethod.SENDTOBACK);
                var currObj = allSymbolItems[ii];
                var newObj = aDoc.symbolItems.add(aDoc.symbols[i]);
                var symbolColor = aDoc.symbols[i].name;
                // Add the new / replacement symbol.
                newObj.left = currObj.left;
                newObj.top = currObj.top;
                newObj.width = currObj.width;
                newObj.height = currObj.height;
                // Remove the old symbol.
                currObj.remove();
                // Bring text back up to the front.
                $.writeln('Bring text to front');
                textLayer.zOrder(ZOrderMethod.BRINGTOFRONT);
                redraw();
                $.sleep(10)
            // Run through each language and each buttonText and save a copy.
            var currArray = helpTextArray;
            var currArrayName = "help";
            for(currLang in currArray) {
                switchText(currLang, currArray);
                $.sleep(10)
                // Run function to save .pngs of each artboard
                exportAll(currLang, symbolColor, currArrayName);
            } // end for (currLang in currArray)
        } // end symbols.length
    } // end if
    function switchText(lang, array) {
        //var textFrms = activeDocument.textFrames;
        var newText = array[lang];
        newText = (newText === "") ? array["en"] : newText;
        for(var i = 0; i < textFrms.length; i++) {
            var isHorizontal = ( textFrms[i].width > textFrms[i].height );
            var scale = 100;
            var scaleMatrix;
            textFrms[i].contents = newText;
               * There's normally an automatic text-resizer here
        } // for var i
    function exportAll(lang, color, buttonText) {
        var artBds = aDoc.artboards;
        var options = new ExportOptionsPNG24();
            options.antiAliasing = true;
            options.transparency = true;
            options.artBoardClipping = true;
        for(var i = 0; i < artBds.length; i++) {
             var currBoard = artBds.setActiveArtboardIndex(i);
             var buttonPosition =  artBds[i].name;
             var newFile = new File(folder.fsName+"/"+buttonText+"_"+color+"_"+buttonPosition+"_"+lang+".png");
             aDoc.exportFile(newFile,ExportType.PNG24,options);
             $.writeln('A file was saved with the name:: '+buttonText+'_'+color+'_'+buttonPosition+'_'+lang+'.png');
             $.sleep(10)
    function revertToOriginal() {
        $.writeln('Revert');
        // Switch the text back to help.
        switchText("en", helpTextArray);
        // For each symbol instance...
        for(var i = 0; i < allSymbolItems.length; i++) {
            // Move text layer out of the line of fire.
            $.writeln('Move text to back');
            textLayer.zOrder(ZOrderMethod.SENDTOBACK);
            var currObj = allSymbolItems[i];
            // Add in the placeholder since we're reverting.
            var newObj = aDoc.symbolItems.add(aDoc.symbols[0]);
            var symbolColor = aDoc.symbols[0].name;
            // Add the new / replacement symbol.
            newObj.left = currObj.left;
            newObj.top = currObj.top;
            newObj.width = currObj.width;
            newObj.height = currObj.height;
            // Remove the old symbol.
            currObj.remove();
            // Bring text back up to the front.
            $.writeln('Bring text to front');
            textLayer.zOrder(ZOrderMethod.BRINGTOFRONT);
            redraw();
            $.sleep(10)
            $.writeln('REVERT');
    revertToOriginal();
    Are there best practices that I'm unaware of here that could be causing this corruption?
    Does anyone know what could be happening?
    The only error I ever get is "Can't open illustration." There's never anything more helpful, so I have no idea what could be going wrong.
    If there's any more information that would be of use to anyone I'd be happy to share. This is wasting a lot of my time and making me pull my hair out like crazy,

    I have not had the time to look over your script but at a glance there are a few things I would handle differently…
    Firstly returning a document to a given state… If you play with this snippet you can see that app.undo() returns to the last called app.redraw() if there is one else it undo's the whole script…
    #target illustrator
    doSymbols();
    function doSymbols() {
        var doc = app.activeDocument;
        var sym = doc.symbols[0];
        for ( var i = 0; i < 4; i++ ) {
            var foo = doc.symbolItems.add( sym );
            foo.position = Array( i * 72, -( i * 72 ) );
            app.redraw(); // Comment this out to see…
        app.undo(); // Returns to last redaw state if any…?
    Secondly your symbols… You know you can just change the symbol instance's symbol reference…? If they are almost the same particualy size then its an easy swap…?
    #target illustrator
    doSymbols();
    function doSymbols() {
        var doc = app.activeDocument;
        var sym = doc.symbols[1]; // Next symbol in the palette
        for ( var i = 0; i < 4; i++ ) {
            doc.symbolItems[i].symbol = sym;
            app.redraw();

Maybe you are looking for