Can i use this script in illustrator?

can i use this script in illustrator?
Newsgroup_User

// This script exports extended layer.bounds information to [psd_file_name].xml
// by pattesdours
function docCheck() {
    // ensure that there is at least one document open
    if (!documents.length) {
        alert('There are no documents open.');
        return; // quit
docCheck();
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var docRef = activeDocument;
var docWidth = docRef.width.value;
var docHeight = docRef.height.value;
var mySourceFilePath = activeDocument.fullName.path + "/";
//  Code to get layer index / descriptor
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
function getLayerDescriptor (doc, layer) {
    var ref = new ActionReference();
    ref.putEnumerated(cTID("Lyr "), cTID("Ordn"), cTID("Trgt"));
    return executeActionGet(ref)
function getLayerID(doc, layer) {
  var d = getLayerDescriptor(doc, layer);
  return d.getInteger(cTID('LyrI'));
var stackorder = 0;
// function from Xbytor to traverse all layers
traverseLayers = function(doc, ftn, reverse) {
  function _traverse(doc, layers, ftn, reverse) {
    var ok = true;
    for (var i = 1; i <= layers.length && ok != false; i++) {
      var index = (reverse == true) ? layers.length-i : i - 1;
      var layer = layers[index];
      //  alert("layer.typename  >>> "+layer.typename ); 
      if (layer.typename == "LayerSet") {
        ok = _traverse(doc, layer.layers, ftn, reverse);
      } else {
  stackorder = stackorder + 1;
        ok = ftn(doc, layer, stackorder);
    return ok;
  return _traverse(doc, doc.layers, ftn, reverse);
// create a string to hold the data
var str ="";
// class using a contructor
function cLayer(doc, layer) {
//this.layerID = Stdlib.getLayerID(doc, layer);
  this.layerID = getLayerID(doc, layer);
  //alert("layer ID: " + this.layerID);
  this.layerWidth = layer.bounds[2].value - layer.bounds[0].value;
      this.layerHeight = layer.bounds[3].value - layer.bounds[1].value;
  // these return object coordinates relative to canvas
      this.upperLeftX = layer.bounds[0].value;
      this.upperLeftY = layer.bounds[1].value;
      this.upperCenterX = this.layerWidth / 2 + layer.bounds[0].value;
      this.upperCenterY = layer.bounds[1].value;
      this.upperRightX = layer.bounds[2].value;
      this.upperRightY = layer.bounds[1].value;
      this.middleLeftX = layer.bounds[0].value;
      this.middleLeftY = this.layerHeight / 2 + layer.bounds[1].value;
      this.middleCenterX = this.layerWidth / 2 + layer.bounds[0].value;
      this.middleCenterY = this.layerHeight / 2 + layer.bounds[1].value;
      this.middleRightX = layer.bounds[2].value;
      this.middleRightY = this.layerHeight / 2 + layer.bounds[1].value;
      this.lowerLeftX = layer.bounds[0].value;
      this.lowerLeftY = layer.bounds[3].value;
      this.lowerCenterX = this.layerWidth / 2 + layer.bounds[0].value;
      this.lowerCenterY = layer.bounds[3].value;
      this.lowerRightX = layer.bounds[2].value;
      this.lowerRightY = layer.bounds[3].value;
   // I'm adding these for easier editing of flash symbol transformation point (outputs a 'x, y' format)
   // because I like to assign shortcut keys that use the numeric pad keyboard, like such:
   // 7 8 9
   // 4 5 6
   // 1 2 3
      var windowW=2048;
      var windowH=1536;
   this.leftBottom = this.lowerLeftX + ", " + (windowH-this.lowerLeftY);
   this.bottomCenter = this.lowerCenterX + ", " +  (windowH-this.lowerCenterY);
   this.rightBottom = this.lowerRightX + ", " + this.lowerRightY;
   this.leftCenter = this.middleLeftX + ", " + this.middleLeftY;
   this.center = this.middleCenterX + ", " + this.middleCenterY;
   this.rightCenter = this.middleRightX + ", " + this.middleRightY;
   this.leftTop = this.upperLeftX + ", " + this.upperLeftY;
   this.topCenter = this.upperCenterX + ", " + this.upperCenterY;
   this.rightTop = this.upperRightX + ", " + this.upperRightY;
  // these return object coordinates relative to layer bounds
      this.relUpperLeftX = layer.bounds[1].value - layer.bounds[1].value;
      this.relUpperLeftY =  layer.bounds[0].value - layer.bounds[0].value;
      this.relUpperCenterX = this.layerWidth / 2;
      this.relUpperCenterY = layer.bounds[0].value - layer.bounds[0].value;
      this.relUpperRightX = this.layerWidth;
      this.relUpperRightY = layer.bounds[0].value - layer.bounds[0].value;
      this.relMiddleLeftX = layer.bounds[1].value - layer.bounds[1].value;
      this.relMiddleLeftY = this.layerHeight / 2;
      this.relMiddleCenterX = this.layerWidth / 2;
      this.relMiddleCenterY = this.layerHeight / 2;
      this.relMiddleRightX = this.layerWidth;
  this.relMiddleRightY = this.layerHeight / 2;
      this.relLowerLeftX = layer.bounds[1].value - layer.bounds[1].value;
      this.relLowerLeftY = this.layerHeight;
      this.relLowerCenterX = this.layerWidth / 2;
  this.relLowerCenterY = this.layerHeight / 2;
      this.relLowerRightY = this.layerHeight;
      this.relLowerRightX = this.layerWidth;
      this.relLowerRightY = this.layerHeight;
  return this;
// add header line
str = "<psd filename=\"" + docRef.name + "\" path=\"" + mySourceFilePath + "\" width=\"" + docWidth + "\" height=\"" + docHeight + "\">\n";
// now a function to collect the data
var isParentAvailable=false;
var prevLayerSetName="";
function exportBounds(doc, layer, i) {
    var isVisible = layer.visible;
    var layerData = cLayer(doc, layer);
//alert("layer.name  >>> "+layer.name );
//alert("typename >>> "+layer.typename);
/*if(layer.parent.name == "ParentTest"){
for(var i in layer.parent){
    alert(" III >>> "+i+"<<<layer.parent>>"+layer.parent[i]);
  if(isVisible){
// Layer object main coordinates relative to its active pixels
var startStr="";
    if(layer.parent.typename=="LayerSet"){
        if(prevLayerSetName!="LayerSet")    {
            startStr="\t<parentlayer id='"+layer.parent.name+"'>\n\t";
        }else{
               startStr="\t";
        // endStr="\t</parentlayer>\n";
         prevLayerSetName=layer.parent.typename;
      }else{
           if(prevLayerSetName=="LayerSet"){
                startStr="\t</parentlayer>\n";
            prevLayerSetName="";
  var positionStr=layer.name.split(".")[0].substr(layer.name.split(".")[0].length-3,layer.name. split(".")[0].length);
  var assetPosition=leftTop;
  if(positionStr=="L_B"){
  assetPosition=leftBottom;
  }else if(positionStr=="B_C"){
  assetPosition=bottomCenter;
  }else if(positionStr=="R_B"){
  assetPosition=rightBottom;
  }else if(positionStr=="L_C"){
  assetPosition=leftCenter;
  }else if(positionStr=="C"){
  assetPosition=center;
  }else if(positionStr=="R_C"){
  assetPosition=rightCenter;
  }else if(positionStr=="L_T"){
  assetPosition=leftTop;
  }else if(positionStr=="T_C"){
  assetPosition=topCenter;
  }else if(positionStr=="R_T"){
  assetPosition=rightTop;
  var str2 =startStr+ "\t<layer name=\"" + layer.name
  + "\" stack=\"" + (i - 1) // order in which layers are stacked, starting with zero for the bottom-most layer
  + "\" position=\"" + assetPosition // this is the
  + "\" layerwidth=\"" + layerData.layerWidth
  + "\" layerheight=\"" + layerData.layerHeight
  + "\" transformpoint=\"" + "center" + "\">" // hard-coding 'center' as the default transformation point
  + layer.name + ".png" + "</layer>\n" // I have to put some content here otherwise sometimes tags are ignored
str += str2.toString();
// call X's function using the one above
traverseLayers(app.activeDocument, exportBounds, true);
// Use this to export XML file to same directory where PSD file is located
    var mySourceFilePath = activeDocument.fullName.path + "/";
// create a reference to a file for output
    var csvFile = new File(mySourceFilePath.toString().match(/([^\.]+)/)[1] + app.activeDocument.name.match(/([^\.]+)/)[1] + ".xml");
// open the file, write the data, then close the file
csvFile.open('w');
csvFile.writeln(str + "</psd>");
csvFile.close();
preferences.rulerUnits = originalRulerUnits;
// Confirm that operation has completed
alert("Operation Complete!" + "\n" + "Layer coordinates were successfully exported to:" + "\n" + "\n" + mySourceFilePath.toString().match(/([^\.]+)/)[1] + app.activeDocument.name.match(/([^\.]+)/)[1] + ".xml");

Similar Messages

  • I purchased Adobe Illustrator CS2 on CD many years ago and now i have bought a new iMac computer it won't let me install from the CD's. How can i use this product on iMac ?

    I purchased Adobe Illustrator CS2 on CD many years ago and now i have bought a new iMac computer it won't let me install from the CD's. How can i use this product on iMac ?

    Because the Nano was previous synced to another comuter/iTunes library.
    See the following:
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities

  • How can i use this sript and loade another movie?

    Hi there, i used the following script to load a movie from the server;
    var request:URLRequest = new URLRequest("url string");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    How can i use this sript and loade another movie? Can someone help me please?
    [edited by moderator]

    Sir, I changed it from:
    var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Dir.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    to
    var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Warning.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    When i expord the movie i get the following error.....
    Scene 1, Layer 'Layer 3', Frame 1, Line 6    1151: A conflict exists with definition request in namespace internal.

  • Can I use Apple Script to press a button?

    Is there some way I can create an Apple Script to run and press a button in another application, or create a "plug-in" type script for the program to make the button into a something that can be used by a keyboard shortcut?
    I ask because I have an application that I can use to operate my digital camera, however, the button that Auto-Focuses then Shoots a photo does not have a keyboard shortcut. This is a problem because I also have the App "Snatch" on my iPhone, and, long story, short, I discovered I could use Snatch on my laptop on an Ad-Hoc network from about 1,000 feet away, maybe more. If I could find a way of making the "AF and Shoot" button into a keyboard shortcut, or create a script that could be triggered by a keyboard shortcut to press the button, I could use Snatch to control my camera remotely, far better then any part I would by from Nikon, or a third-party (Trust me, I have used a lot of them, and this method beats them all, save for the fact that I can't use bulb.)
    Anyway, thanks for any input, if any.

    Even if an application is not scriptable, you can generally use [GUI Scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html] to press a button. For example, using Canon's RemoteCapture DC software, the script below will press the "Release" button of the main window:
    tell application "RemoteCapture DC" to activate
    tell application "System Events"
    tell process "RemoteCapture DC"
    click button 4 of window "RemoteCapture DC"
    end tell
    end tell
    If you then put the above script in the AppleScript menu in the menu bar, you should be able to use a third party application, like Quicksilver, to assign a keyboard shortcut to it.
    Message was edited by: Pierre L.

  • Only the last account is created when using this script in combination with a CSV

    Hi, I've got a weird problem when using this script:
    $Users = Import-Csv -Delimiter ";" -Path "......csv"  
    FOREACH ($User in $UserList) { $ User }
        $OU = $User.path
        $UPN = $User.UPN
        $Password = $User.password 
        $Detailedname = $User.firstname + " " + $User.Lastname 
        $UserFirstname = $User.Firstname 
        $FirstLetterFirstname = $UserFirstname.substring(0,1) 
        $SAM =  $User.UPN
        $Company = $User.company
        $Description = $User.description
        $AccountExpirationDate = $User.accountexpirationdate
    $params = @{ 'Name'=$Detailedname;
                 'SamAccountName'=$SAM;
                 'UserPrincipalName'=$SAM;
                 'DisplayName'=$Detailedname;
                 'GivenName'=$UserFirstname;
                 'Surname'=$User.Lastname;
                 'AccountPassword'=(ConvertTo-SecureString $Password -AsPlainText -Force);
                 'Enabled'=$True;
                 'PasswordNeverExpires'=$True;
                 'Path'=$OU;
                 'Company'=$Company;
                 'Description'=$Description;
                 'AccountExpirationDate'=$AccountExpirationDate }
    New-ADUser @params
    The CSV file has columns with the name: Lastname;Firstname;Password;Company;Description;UPN;path;AccountExpirationDate
    Script runs without errors, but only creates the last line in the CSV file. Anyone that can help me, of put me in the right direction? Should be great!
    Michiel
    the Netherlands

    Hi Michiel,
    You'll need to move $params and New-ADUser up into the foreach loop.
    EDIT: Also, remove the { $ User } that you have next to the foreach loop. You're also using $Users instead of $UserList.
    EDIT2: Here's a cleaned up version:
    $UserList = Import-Csv -Delimiter ";" -Path "......csv"
    FOREACH ($User in $UserList) {
    $OU = $User.path
    $UPN = $User.UPN
    $Password = $User.password
    $Detailedname = $User.firstname + " " + $User.Lastname
    $UserFirstname = $User.Firstname
    $FirstLetterFirstname = $UserFirstname.substring(0,1)
    $SAM = $User.UPN
    $Company = $User.company
    $Description = $User.description
    $AccountExpirationDate = $User.accountexpirationdate
    $params = @{ 'Name'=$Detailedname;
    'SamAccountName'=$SAM;
    'UserPrincipalName'=$SAM;
    'DisplayName'=$Detailedname;
    'GivenName'=$UserFirstname;
    'Surname'=$User.Lastname;
    'AccountPassword'=(ConvertTo-SecureString $Password -AsPlainText -Force);
    'Enabled'=$True;
    'PasswordNeverExpires'=$True;
    'Path'=$OU;
    'Company'=$Company;
    'Description'=$Description;
    'AccountExpirationDate'=$AccountExpirationDate
    New-ADUser @params
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How best can i optimise this script

    I have a script the loops through a table and function. it works fine but it takes a longer time complete even though resources are given. the code below is just the same code i used how best can i represent it for speed even though i have all resources.
    For each_member in ( select from MemberTable where MemberID = 'ALL')*
    Loop
    Begin
    if Age >= 18 then
    hold:= 'Adult'
    end if;
    For Each_history in (select Acct,fx_function(each_member.ID,each_member.Acct) BR,
    Movement from History a where history_ID =each_member.Id)
    loop
    Begin
    insert into NewFilteredData (act,BR,mvt)
    values (Each_history.Acct,Each_history.BR,Each_history.Movement);
    end loop;
    end loop;
    end loop;
    commit;
    How best can i optimize this script to move data faster because they are a lot about 6000000 records to be moved.
    please help.
    Edited by: kama021 on Aug 25, 2009 12:48 PM
    Edited by: kama021 on Aug 25, 2009 12:48 PM

    Unless something is horribly wrong (i.e. the optimizer picks a radically incorrect plan), if you can do something in SQL, it will always be faster to do it in SQL. Doing things in PL/SQL, particularly using cursor FOR loops and single row inserts, is the slowest possible way to do anything (well, other than having nested FOR loops).
    Long before you start looking at things like the APPEND hint, I would focus on implementing a single SQL statement that generates the correct results. Once you have that and you have a benchmark, you can decide whether it is "fast enough". If it is (and I suspect it will be), you don't have to delve any deeper. If you need more performance, you can start looking into parallelism, the APPEND hint, etc. but be aware that this generally increases the complexity of the system.
    Justin

  • How can I use my fonts in Illustrator (CS4) without Suitcase?

    How can I use my fonts in Illustrator (CS4) without Suitcase? InDesign has a fonts folder, but not Illustrator.

    i found this info from this link: http://forums.adobe.com/message/3466307.  The user who asked this question stats this solution worked for them.
    First in Language and text preferences in the system preferences select Hebrew as the input method.
    The in Illustrator click the text tool in your document or drag to create a text frame.
    While the cursor is active select a hebrew font
    then go to the menu bar for the finder and where there is the American Flag pull it down and select hebrew
    now go back to the document and start typing.
    Remember if you do not have the ME version you have to have it flush right and type backwards.

  • Can we use Java Script in SAP BusinessObjects Web Intelligence 4.1?

    Can we use Java Script or any other Script in BI 4.1 Web Intelligence? If possible please do let me know the method/process

    Hi Kranthi,
    You have option to read a cell content as html. else you will have to go for SDK. I think you will get better suggestions, if you can explain your requirement in a little detailed manner.
    refer below links for more details about SDK.
    http://bukhantsov.org/2013/04/how-to-create-a-webi-document-using-java-report-engine-sdk/
    Regards,
    Nikhil Joy

  • I recently bought a new iMac as well as a wireless time capsule and have it connected how can I use this external drive as the location to store all my files for iTunes, or is this even possible?

    New iMac user here, I recently bought a new iMac and Time capsule and have the whole network up and running now. I have connected another external HD to the time capsule as well and have a total of 3 TB of storage connected wireless to my new iMac. My question is can I use this location as the default location for iTunes?  I doubt I am gonna run out of room considering the iMac has 1 TB of storage already, but I'd prefer to keep my movies and music off the Mac to keep it running smoothly. If this is possibly, I'd like to do this with iPhoto as well. 

    I would advise against placing your iTunes library on a Time Capsule.
    The Time Capsule is designed as a backup device and not for wireless streaming of video.
    Before you do anything more, can I suggest you put into place a reliable, redundant backup strategy.
    Unless you are prepared to risk loss of your iTunes library due to a hard drive failure, I would not put iTunes on the Time Capsule.
    Leave your iTunes library on your iMac until such time as your internal drive is full. Backup to Time Capsule using Time Machine and create a clone of your internal iMac HD to your external drive.
    That's my 2 cents worth. Others may have a different opinion.

  • HT1222 I bought used iPhone and on this iPhone I'm not able to make new account  on i Cloud'.  How can I use this iCloud's on used iPhone   Please help me

    I bought used iPhone and on this iPhone I'm not able to make new account  on i Cloud'.  How can I use this iCloud's on used iPhone   Please help me
    When I logging there it told me that maximum no of iCloud's Account already activated on this iPhone.
    Please help me how can I open new iCloud's account on this iPhone
    Regard
    Faiz khan

    Set up the account using a desktop or laptop, then sign
    into that account on your iPhone.
    I am not aware of any method around the restriction once
    the maximum has been created on any individual iPhne.

  • Can i use this download and install on multiple computers?

    Can i use this download and install on multiple computers?

    I assume you're talking about the Lion installer?  If so, yes, you're allowed to use it on any machines authorized with your Apple ID (which I believe means a maximum of five machines).  This is, of course, meant for family use...  I'm not sure about business use, but I'd suspect you need one copy per machine at a business.  If you're in that situation, you may want to wait for the $69 Lion flash drive Apple will be releasing next month sometime, as that won't be tied to an Apple ID.  But check with Apple to be sure on that.

  • I have a dollar amount balance on my itunes account... can i use this to purchase apps for my MacBook Pro?

    I have a dollar amount balance on my itunes account... can i use this to purchase apps for my MacBook Pro?

    You should be able to.  As long as you are signed in to the same AppleID that has an available balance.  The services are linked.

  • With the online package of PS/LR, how many machines can I use this on?

    With the online package of PS/LR, how many machines can I use this on? Can I have it at work and home?

    2 Computer License http://forums.adobe.com/thread/977272

  • Limited storage in iPhone so i bought 20g iCloud. how can i use this iCloud storage in my device to store music and photos?

    I have a limited storage in iPhone so i bought 20g iCloud. how can i use this iCloud storage in my device to store music and photos?

    Welcome to the Apple Community.
    You could sign up for iTunes match and use iCloud photo library with optimisation enabled. The later will keep optimised photos on your device and iTunes match will let you access your whole collection and make room for newer content by removing older unplayed items.

  • Updated to 10.6.8 and now safari, system preferences, address book say "can't use this version"

    Got a new harddrive in my 2010 macbook pro and rebooted it with time machine back up from a older mac running 10.5.8.  I loaded snow leopard 10.6 from disc then updated to 10.6.8 on new computer after restore from back up.  Now the Safari icon, system preferences and address book won't open and a box opens saying you can't use this version of the application system preferences with this version of mac os X      You have sytem preferences 5.2.  or safari says you have safari 5.0.6 etc.  How do i update the apps so i can make them actually open.  I can get them open in a round about way but not from the icons on my sidebar. 

    If you have an os on the hdd, why not do a clean install of the os (erase the drive and reinstall osx snow leopard) For snow leopard you insert the osx disk, restart the machine while holding down the c key
    http://support.apple.com/kb/HT3910
    Message was edited by: victoryhat

Maybe you are looking for

  • DVI mini to Video S-video out?

    I am trying to connect my Mac book to my tv and I'm having a few issues. I bought the Mini dvi converter (twice now that i thought the first was busted) and have tried to connect to 3 different tv's but I am either getting a black screen or a flicker

  • How can i transfer music and photos from my ibook g4 to my new mac mini?

    the g4 has a firewire 400 and the mini is firewire 800.  IS there 400 to 800 firewire or a male-male usb2 cable out there?  I've tried moving files to my external drive and then moving to the mini but the photos move over as one event. The music move

  • Media encoder CS4 can't do what Flash Encoder CS3 does????

    Quad 2.66 Xeon MacPro / OS 10.5.8 / CS4 all updates applied. / 24GB RAM Adobe Media Encoder CS4 won't import .wmv videos. Flash CS3 Media Encoder does it just fine. What's the deal? Why remove the support? I do have Flip4Mac installed as well as Peri

  • [DQS Cleanse] Error

    All,       I'm trying to cleanse data and I'm continually getting the error message below.  I'm cleansing data such as first and last name, state and country.  I have been able to process nearly 500,000 but now for some reason I'm getting the error b

  • HT1766 Syncing error message (1140)

    Trying to sync/backup iPhone 5 to iTunes on iMac, I get an error message "an unexpected error occured (1140)"