Let's get out the the infamous bridgetalk activedocument

BridgeTalk is a gene. I hate the hoop jump to to get the dialog boxes and windows in the palette to interact with Illustrator.

That said, from my testing, it seems that everything that is really needed to 'bike' a script... is the active document.

In most of my scripts, it seems, if I get the active doc object so I can keep my script currently on the document in question.

I was playing with this code:

#target illustrator
#targetengine main

doc = function() {
  var bt;
  bt = new BridgeTalk();
  bt.target = 'illustrator';
  bt.body = 'foo()';
  bt.onResult = function(x) {
  $.writeln('result', x.body); // result[Document test.ai]
    // somehow return active document from onResult
  };
  bt.send();
};


function foo() {
  return app.activeDocument;
}


var activedoc = doc();
// do something with activedoc ...

// and later, like in a palette window button onclick:

activedoc = doc();
// keep workng on activedoc...

It's hard for me to explain (as I write this message in frustration), but I'm trying to think of a way to make things BT simpler than what I made (and seen) in other code.

Basically, it seems that all it takes is the activedoc. If I have the active doc then my code can continue to work on things.

The problem is BT returns a string and not an object.

Is long story short, possible for me to convert the string in the active document into a usable object?

Maybe I could parse the string for the "test.ai", then a little more code allows you to enter the "activedocument" of the name of the file object?

One of my questions make sense to anyone?

Thank you!

M

Did I mention I don't like bridgetalk? It just makes so messy script... Feels hacky to me.

but to answer you question, I don't think there's a way to transform your string into a "usable" object doc doc. In fact, you can pass the object real doc in Illustrator to javascript via BT using yourdoc.toSource (), and then rebuild the string into an object object using eval(), but you still can't talk to illustrator

Tags: Illustrator

Similar Questions

  • How to get out the mode safe mode with msconfig.

    I'm working on my computer and need to start in safe mode. I ran the msconfig and reboot the laptop. I get to the login screen, but when I get my username and password it tells me that the user name and password is not correct. How to get out the mode safe mode with msconfig.

    When you run msconfig to get set to Safe Mode, you just activate/check the option/SafeBoot at startup. INI tab or did you do something else?

    There is some malware that if you use the/SafeBoot option, you will not be able to use your system again until you remove the switch/SafeBoot the boot.ini for you can boot normally.

    Maybe it's not your exact problem, but I will never suggest to anyone to use the option / SafeBoot never again - too risky when troubleshooting since you can always start new or will never connect again until you remove the switch/SafeBoot.

    Anywho, if that's what you have done, you can start in the XP Recovery Console and then either make a new boot.ini file containing the switch/SafeBoot or simply rename the boot.ini file, you have something like boot.ini.old if you don't have a boot.ini file (I know it seems like a weird idea).

    In a single partition configuration, XP is not even a file boot.ini to boot.  XP will complain if there is no boot.ini file, but will always start very well without one (non-believers - try it!).

    After you get booted up and logged in, you can rename boot.ini.old in boot.ini and run msconfig to remove the option/SafeBoot, and never use it again.

  • When I connect the HDMI cable to my laptop, the screen goes black and I can't lift the office unless I get out the HDMI cable

    When I connect the HDMI cable to my laptop, the screen goes black and I can't lift the office unless I get out the HDMI cable. It happened all of a sudden I used he linked TV to catch-up on TV episodes until last night when it happened out of the blue!
    Can someone please help with this.

    Contact the manufacturer of your laptop.  Also - that there might be a key combination for your laptop that changes the screen from the main output is - look at your documentation or on your keyboard for such a combination of keys (what kind of computer is? Make & model...)

  • tried for three days trying to get this working and I've already tried some of the suggestions forum and it's just to try... so happy I don't have pais nothing yet. I get out the signed loop no matter what I try

    tried for three days trying to get this working and I've already tried some of the suggestions forum and it's just to try... so happy I don't have pais nothing yet. I get out the signed loop no matter what I try

    While in have you really tried? It's the standard solution, and it works in all cases that I have heard (including mine). Just rename the file, and a new one is created on the next launch.

  • How to get out the address book?

    When I choose a contact, I can return to the editField interface and as SUCH get set to the editField,

    but now if I didn't chosse contact, I want to return to the editField interface, it shows Nullpointer Exception.

    so, how can I get out of address book?

    showAddressBook my code:

    public void showAddressBook() {}
    try {}
    Contact list BlackBerryContactList = (BlackBerryContactList) BlackBerryPIM.getInstance () .openPIMList (BlackBerryPIM.CONTACT_LIST, BlackBerryPIM.READ_WRITE);
    Contact BlackBerryContact = (BlackBerryContact) contactList.choose (null, BlackBerryContactList.AddressTypes.EMAIL, true);
      
    Portable chain = "";
    int numValues = 0;
    numValues = contact.countValues (BlackBerryContact.TEL);
      
    for (int i = 0; i)< numvalues;="" i++)="">
    If (contact.getAttributes (BlackBerryContact.TEL, i) == BlackBerryContact.ATTR_MOBILE) {}
    Cell = contact.getString(BlackBerryContact.TEL, i);
    break;
    }
    }
             
    editField.setText (mobileNumber);
    } catch (PIMException ex) {}
    ex.printStackTrace ();
    }
    }

    If the user decides to not choose a contact, you get null as a return value. your code should check this.

  • How to get out the year following the date

    Hi all

    I'm couldn't get out of the year to date.
    in my table it has been stored in varchar format on January 11, 2005
    If I want to display the year of the column, then
    I tried with year (to_date (' ' jan 11 2005 ', ' mm dd yyyy ' "))
    but I get an error then, how should I go out the year of the date_column

    thnks

    Hello

    Use RIGHT(DATE_COLUMN,4)

    Thank you
    Saichand.v

  • Canon ip2700 series - why not market my printer not working... has the ink... I get out the empty ink color box... It would make a diff.

    Hello... Why doesn't my printer?  He says need new ink... so I put a new... and it has always worked after I did it... now, the yellow light flashes on and OFF... and the green light too... my color jet ink was empty so I pulled out the box... only my ink blk in there now... it's only 2 years... is cause I took the thing out there color?                           THANK YOU SO MUCH L.S. HELP PLEASE

    We do not know. You should consult the manual and if this help not ask to the manufacturer (Canon).

  • Can't get out the cloud iBooks

    Because I downloaded iOS 9.3.4 I can download my iBook to iCloud, but they does not open, says I don't have enough storage, I still 2.7 GB free... If anyone can help?

    Hello KHvG,

    Thank you for using communities Support from Apple. I know have a problem with the iBooks app, it's not what you expect. If I understand correctly, you are able to tap the cloud beside books icon are not currently on your device to download, but you are not able to open and get an error, you do not have enough storage. Here's what I suggest for this problem:

    1. first of all, open the multitasking on your device and force parameters and the iBooks app to close.

    Force a nearby application on your iPhone, iPad or iPod touch

    2. then restart your device under the tap down and starting process is important to keep the iOS software works correctly. Then retest your iBooks issue:

    Restart your iPhone, iPad or iPod touch

    3. If you experience this problem when you try to download from iCloud in the section my books in the iBooks app, try to go to the area of purchase and start the download process.

    Download your latest purchases

    4. If you still get messages on the disk space, check your storage device, which is different from storage available iCloud. Here is more information on the operation of storage:

    Check your storage space on your iPhone, iPad and iPod touch

    See you soon!

  • How to get out the white on black high contrast?

    How to get white on black high contrast for my Firefox screen?

    This has happened

    Each time Firefox opened

    Is yesterday. I closed and then later opened Firefox and got the high-contrast display.

    See also;
    Website colors are not
    Web sites look bad or display differently they should

  • Hey I have windows 7 and a new coumputer. so when I got home I tried to download java and there is a dll error 1723 but its downloaded... but it won't let me get on the game make java needs although it is downloaded any idea? __

    idk what is happening on any idea?

    Hello

    Welcome to the Microsoft Vista answers Forum!

    I suggest you to follow these steps and check if it works because what this problem could occur if conflicts of software or compatibility issue.

    You will need to perform the compatibility check of software for the program installed on windows 7 on your computer.

     

    For this you need to follow the link below.

     

    http://www.Microsoft.com/Windows/compatibility/en-us/default.aspx

    Now, try to install the latest Java program on your computer and check for the issue because the java installed on the computer is incompatible with windows, I suggest you download and install the latest version.

    Follow this link provided below to install the latest java program.

    http://download.Java.NET/jdk6/

    Restart your computer and search for the issue.

     

    Thank you, and in what concerns:

    Aito - Microsoft technical support.

    Visit our http://social.answers.microsoft.com/Forums/en-US/answersfeedback/threads/ Microsoft answers feedback Forum and let us know what you think.

  • How can I get out the Paint program?

    She picks up when I'm trying to make shapes inny or documents

    Hey dude,

    Check out this article, I'm sure it will help you with this problem.

    With the help of paint: http://windows.microsoft.com/en-US/windows-vista/Using-Paint
    Painting tools: http://windows.microsoft.com/en-US/windows-vista/Paint-tools

  • I have a Trojan horse in my computer. I have windows xp. I ran avg, but it can't get out the Trojan horse. the computer is very slow and I'm not able to use ctrl + alt + del, or recovery system. If I uninstall windows and install it and then return. who w

    I also get messages saying: my computer is infected by trojan and I should update my spyware... but I think that the message box may come the virus itself...

    Karina...

    It would probably be best for you to use the free services of a reputable online organization that specializes in the removal of malicious virus/trojan/software.  There are now available on the internet.

    Such a forum is hosted by Safer Networking Ltd., authors of the popular software 'Spybot S & D'...

    http://forums.Spybot.info/forumdisplay.php?f=22

    You may want to consider giving them a try, BUT... do not forget to try to comply with their preliminary instructions before asking for help.

    Good luck

  • How to get out the sections as separate Web pages user guide?

    I have a guide of heavy use (MS Word file) which has several sections and subsections (e.g., 1.2, 1.2.3 etc.). When I pulled out using Webhelp, Responsive HTML5 or any other SSL, the guide is published under a long Web page. I can use the table of contents to access certain sections, but I can of course scroll upwards or downwards for other sections. Is there a way to isolate and each section as well as a separate page, while keeping the table of contents complete?

    It would be extremely tedious to split the Word file, then import them individually into Robohelp...

    I am very new to Robohelp, so any help is very appreciated! Thank you!

    I moved this post to the RoboHelp for Word forum, existing links will continue to work. RoboHelp for Word is a separate product that no longer ships with RoboHelp.

    The document can be divided according to the styles then maybe you can set styles to give the breaks you want. On my site, see Importing and creating a binding.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Disk with bad sectors - how to get out the data?

    I have a drive that is on its way in my lab at home. He got a few virtual machines on that I'd like back. The SMART State shows a few hundred bad sectors. I use ESXi 5.1 build 799733

    VMS seem to run but when I try to copy them to another disc from the vSphere client, I get a generic error and it hangs on. VMkernel.log displayed I/O failure of questions and 'unexpected sense '.

    I wonder if:

    (1) there is a way to get ESXi try again to copy several times because I think that the copy may succeed after several attempts (given that the VMs system run OK but can not copy them).

    (2) it is possible to run something similar to a chkdsk utility that can be run on the vmfs to see if the file system can recover bad blocks?

    (3), a last resort is it possible to get ESXi to continue with the copy despite IO errors. Maybe then I can run chkdsk inside the BONE and it will heal.

    (4) what are the tools (if any) can I use to clone the drive dying on a well known disc? DD work?

    I agree with the suggestion to try gddrescue.
    The problem THAT VM power off - start a Linux VM from a different data store and get the data store with bad blocks via vmfs-fuse and sshfs.
    Then copy the outside through ddrescue flat.vmdk.

    Sometimes it also helps to manually create a snapshot for the bad VM on another data store. Who sets the origin vmdk in read-only mode.
    Once you have the snapshot you can clone then the empty new snapshot with the basedisk damaged via vmkfstools - i.

  • Get out the value cell by the control program DataGrid does not work

    Hi, I would like to get the value of the cell in datagrid, for example the cell [3,4] = value of row 3, column 4. I found this code that works (almost) perfectly:

    private void getCellValue(event:ListEvent):void {}
    Get the purpose of this event (Datagrid)
    var dataGrid:DataGrid = event.target as DataGrid;
    Get the index of the selected column
    var dsColumnIndex:Number = event.columnIndex;
    Get the DataGridColumn object to get the name of the selected column
    Col: DataGridColumn var = dataGrid.columns [dsColumnIndex];
    Value of the selected cell get the selected row and column name
    var cellValue:String = dataGrid.selectedItem [col.dataField];
    Alert.Show (cellValue);
    }

    ...

    < mx:DataGrid width = '100 percent' dataProvider = "{browseItems}" doubleClickEnabled = "true" itemDoubleClick = "getCellValue (event)" >
    < mx:columns >
    < mx:DataGridColumn headerText = "First name" dataField = "FirstName" / >
    < mx:DataGridColumn headerText = "Name" dataField = "lastname" / >
    < mx:DataGridColumn headerText = "Type of person" dataField = "personType.code" / >
    < / mx:columns >
    < / mx:DataGrid >

    When you double-click the datagrid control, it shows the u-value of u cell clicked. Everything is ok, BUT it only works for primitive types or attributes of the direct object. When I click on a cell, which contains an object any (association of another object) - for example the 3rd person column type that contains object PersonType from here only display attribute code - it doesn't work - I can not the value of the field like that. I can see the value in datagird, but it is not possible to obtain this value programmatically, or I don't know how to do it. Other columns works well. Any suggestions? Thx for the help

    You need to check for the '. ', it will break and loop on the parts.

    There should be a code in the DataGridColumn that you can copy

Maybe you are looking for