Edit this script?

I am fairly limited in scripting - would it be possible to edit the following script to allow me to export the artwork for 1 track of each disc?
Album Art to Album Folder v1.3
I would like to make a large poster of my album artwork and want a script to export the artwork from each album (say from track 1 or each album which i could easily specify with a smart folder in itunes.) I know there is software for purchase which does this, but i imagine this will be a one-time project, not something i feel a need to purchase.

So, you want to take the art from each album and write that image file to the iTunes album folder. That is exactly what the script does.
After that is done, you want to gather up the images and stitch them all together into one giant image. Is that right?
This is a 3 part project.
You would use the script at that page, but edit the my_scale setting it to some reasonable size for consistency. iTunes images are all kinds of sizes and that won't make a very good pastiche. Normally the smallest size image becomes the standard all need to be reduced to, but the script expands too, although the smallest ones will look pixelated if you do that.
With that done, you would run a command in Terminal to find all jpg and png images and move them to one folder. Someone else can help you with that.
Then, you would run Graphic Converter: http://lemkesoft.de/ and use the menu item File>Merge Folder into One Image...
Hope that gives you some ideas.

Similar Messages

  • How do I edit this script (newbie)

    Editing a script
    I found a script that creates a reminder event based upon the birthdays of my contacts in Address Book. It looks forward one week at a time.
    I'm not familiar with creating scripts. How would I edit this to do the following (if possible)
    1- I set up a contact list in Address Book for only those people whose birthdays I want to be reminded of. Is it possible to have this script only look through this contact list, not every contact.
    2- Can it also be set up to delete the previously set events (so that the only events that appear are the ones for the ensuing week)
    3- Can it be set up to remind me of anniversaries also? How would I edit it? (I tried to find and replace the term birthday with anniversary, but all it did was notify me of forthcoming week's birthdays but called them anniversaries)
    Thanks!
    ===============
    birthdayAlert.scpt
    User set variables
    set numberDaysNotice to 1 -- how many days before the birthday to alert you, 0 is that day
    set timeOfNotification to 5 -- the hour you want the notification
    set selectedCalender to "Birthday Reminders" -- the calender in iCal you want to add the events to
    Setup
    set birthdayPeople to {}
    set birthdayDates to {}
    Get the current date & next week
    set today to current date
    set nextWeek to today + (60 * 60 * 24 * 7)
    Loop through everyone in the Address Book
    tell application "Address Book"
    set peopleArray to the name of every person
    repeat with i from 1 to count of peopleArray
    set thisPerson to person i
    set thisBirthday to birth date of thisPerson
    Check if they've got a birthday entered on their card
    if thisBirthday is not equal to (missing value) then
    set year of thisBirthday to year of (current date) -- otherwise it uses their birth year
    See if it's in the next week
    if (thisBirthday is greater than today) and (thisBirthday is less than nextWeek) then
    set thisBirthday_day to day of thisBirthday
    set thisBirthday_month to month of thisBirthday
    Add them to our list
    set birthdayPeople to birthdayPeople & name of thisPerson
    set birthdayDates to birthdayDates & birth date of thisPerson
    end if
    end if
    end repeat
    end tell
    If we have birthday's go into iCal and add the alerts
    if (count of birthdayPeople) is greater than 0 and ((count of birthdayPeople) is equal to (count of birthdayDates)) then
    tell application "iCal"
    tell calendar selectedCalender
    repeat with i from 1 to count of birthdayPeople
    set thisDate to item i of birthdayDates
    set year of thisDate to year of today
    set time of thisDate to (60 * 60) * timeOfNotification
    set day of thisDate to (day of thisDate) - numberDaysNotice
    set thisEvent to make new event at end with properties {description:"", summary:(item i of birthdayPeople) & "'s Birthday", location:"", start date:thisDate, end date:thisDate + 15 * minutes}
    tell thisEvent
    make new display alarm at end with properties {trigger interval:0}
    end tell
    end repeat
    end tell
    end tell
    end if

    1- I set up a contact list in Address Book for only those people whose birthdays I want to be reminded of. Is it possible to have this script only look through this contact list, not every contact.
    Sure - if you created a specific group of the people you want to track then just change the line:
    set peopleArray to the name of every person
    to:
    set peopleArray to the name of every person of group "Birthdays"
    (or whatever group name you used). You see, as written your script just grabs everyone's name as opposed to just the names of people in the specific group.
    2- Can it also be set up to delete the previously set events (so that the only events that appear are the ones for the ensuing week)
    Yes, but that's a little trickier since you need some way to denote which events are birthday events vs. other events from last week. If you're using a specific calendar for this then you could just delete existing events in that calendar, or you could implement a minor change to the way you create events - use the description to identify this is one of your auto-created birthday alarms:
    set thisEvent to make new event at end with properties {description:"birthday", summary:(item i of birthdayPeople) & "'s Birthday", location:"", start date:thisDate, end date:thisDate + 15 * minutes}
    So now the events will have a specific description, so it's easy to start your new script off with a line that deletes existing 'birthday" events, via:
    tell application "iCal"
      delete every event of calendar selectedCalendar whose description = "birthday"
    end tell
    (you can nix the '... whose description = "birthday"' element if you just want to delete all existing events in the calendar).
    3- Can it be set up to remind me of anniversaries also? How would I edit it? (I tried to find and replace the term birthday with anniversary, but all it did was notify me of forthcoming week's birthdays but called them anniversaries)
    Sure, that's because you specifically ask Address Book for birthdays:
    set thisBirthday to birth date of thisPerson
    To track anniversaries you need to ask Address Book for different data. This one's a little tricker since anniversaries are tracked via the custom date element, so you'd need something like:
    set anniversaryList to {}
    tell application "Address Book"
      repeat with eachPerson in (get every person) -- add 'of group "anniversaries' if you use a specific group
        repeat with eachDate in eachPerson's custom dates
          if label of eachDate = "anniversary" then
            -- this person has an Anniversary set, so add your code here to check if eachDate is in the next week if it is:
            copy eachPerson to end of anniversaryList
          end if
        end repeat
      end repeat
    end tell
    At the end of this you'll have a list of people whose anniversary is upcoming and you can duplicate your iCal code to add anniversary events in addition to birthdays.

  • Edit this script so .log replaces .jpg

    Here's portion of script I'm editing: As it is it results in .log is appending to filename. Thus I end up with filename.jpg.log. How do I get it change filename to filename.log? (Filetype is of no concern here). This needs to be unattended.
    tell application "Finder"
    repeat with i from 1 to number of items in the added_items
    set this_item to (item i of the added_items)
    set fileName to name of this_item
    set AppleScript's text item delimiters to "."
    if fileName ends with ("jpg" as text) then set newFileName to (text items 1 thru 2 of fileName) & "log" as text

    Also note that the nameproperty includes the name extension, so sometimes it is handy to extract one from the other. I use a handler to get the portions of the name:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    -- get name parts from a file
    on run -- example
    set TheFIle to (choose file)
    set {TheName, TheExtension} to (GetTheNames from TheFIle)
    display dialog "Name:        " & TheName & return & "Extension:  " & TheExtension
    end run
    to GetTheNames from SomeFile
    get a name and extension from a file path
    parameters - SomeFile [mixed]: a complete file path
    returns [list] - item 1 [text]: the name
            item 2 [text]: the .extension (if no extension, the value returned is "")
    set SomeFile to SomeFile as text
    if SomeFile begins with "/" then set SomeFile to (POSIX file SomeFile) -- assume a POSIX path
    set {name:TheName, name extension:TheExtension} to info for (SomeFile as alias)
    if TheExtension is in {missing value, ""} then
    set TheExtension to ""
    else
    set TheExtension to "." & TheExtension
    end if
    set TheName to text 1 thru -((count TheExtension) + 1) of TheName
    return {TheName, TheExtension}
    end GetTheNames
    </pre>

  • For multiple selection this script edit help

    2 or 3 selection text frame this script run?
    selection = app.activeDocument.selection;
    for (var j = 0; j<selection.length; ++j);
    var doc = app.properties.activeDocument, 
        myOnjectStyle = doc.objectStyles.itemByName = "myObj1", 
        myObjects, l;
    app.findTextPreferences = app.changeTextPreferences = null; 
    app.findTextPreferences.findWhat = "^a"; 
    myObjects = (app.selection && app.selection[j]).findText () || doc.findText (); 
    l = myObjects.length; 
    while(l--) myObjects[l].pageItems[0].appliedObjectStyle = myOnjectStyle;
    n = app.selection[j].textFrames.length;   
    while (n >= 0)   
         try {   
              var islem = app.selection[j].textFrames[n];
              islem.appliedObjectStyle = "myObj2";
         } catch(_) {}   
         n--;   

    sorry....i did't mention my error......this is my error...
    com.sap.tc.webdynpro.progmodel.context.ContextConfigurationException: DataNodeInfo(Listcustcntrlr.Zread_Input.Output.Es_Mara): structure field __Bev1__Luldegrp not found
    with regards,
    Gobi

  • Please assist with modifying this script to read in a list of servers and output results to excel

    Hello,
    I have an excellent script written by Brian Wilhite to gather the last logged in user using Powershell.
    http://gallery.technet.microsoft.com/scriptcenter/Get-LastLogon-Determining-283f98ae/view/Discussions#content
    My Powershell Fu is stumbling to modify this script to the following requirements:
    Currently the script must be loaded first into Powershell, then it can be executed.  I would rather edit the script in my Powershell ISE, add the .txt file to the script itself that gives a list of the servers I need to scan.  Then when I
    press Run Script in my ISE it executes.
    I would also like to output the results of the file to excel (.xls or .csv will do).  Currently the results look as follows:
    Computer : SVR01
    User : WILHITE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    I would prefer it shows up like so:
    Computer User SID Time Currently LoggedOn
    SVR01 WILHITE\BRIAN S-1xxx 9/20/2012 1:07:58 PM FalseSRV02 WILHITE\BRIAN S-2xxx 9/26/2014 10:00:00 AM True
    Any help you can provide would be greatly appreciated.  I'll add the full script to the end of this post.
    Thank you.
    Function Get-LastLogon
    <#
    .SYNOPSIS
    This function will list the last user logged on or logged in.
    .DESCRIPTION
    This function will list the last user logged on or logged in. It will detect if the user is currently logged on
    via WMI or the Registry, depending on what version of Windows is running on the target. There is some "guess" work
    to determine what Domain the user truly belongs to if run against Vista NON SP1 and below, since the function
    is using the profile name initially to detect the user name. It then compares the profile name and the Security
    Entries (ACE-SDDL) to see if they are equal to determine Domain and if the profile is loaded via the Registry.
    .PARAMETER ComputerName
    A single Computer or an array of computer names. The default is localhost ($env:COMPUTERNAME).
    .PARAMETER FilterSID
    Filters a single SID from the results. For use if there is a service account commonly used.
    .PARAMETER WQLFilter
    Default WQLFilter defined for the Win32_UserProfile query, it is best to leave this alone, unless you know what
    you are doing.
    Default Value = "NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
    .EXAMPLE
    $Servers = Get-Content "C:\ServerList.txt"
    Get-LastLogon -ComputerName $Servers
    This example will return the last logon information from all the servers in the C:\ServerList.txt file.
    Computer : SVR01
    User : WILHITE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    Computer : SVR02
    User : WILIHTE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 12:46:48 PM
    CurrentlyLoggedOn : True
    .EXAMPLE
    Get-LastLogon -ComputerName svr01, svr02 -FilterSID S-1-5-21-012345678-0123456789-012345678-012345
    This example will return the last logon information from all the servers in the C:\ServerList.txt file.
    Computer : SVR01
    User : WILHITE\ADMIN
    SID : S-1-5-21-012345678-0123456789-012345678-543210
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    Computer : SVR02
    User : WILIHTE\ADMIN
    SID : S-1-5-21-012345678-0123456789-012345678-543210
    Time : 9/20/2012 12:46:48 PM
    CurrentlyLoggedOn : True
    .LINK
    http://msdn.microsoft.com/en-us/library/windows/desktop/ee886409(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/system.security.principal.securityidentifier.aspx
    .NOTES
    Author: Brian C. Wilhite
    Email: [email protected]
    Date: "09/20/2012"
    Updates: Added FilterSID Parameter
    Cleaned Up Code, defined fewer variables when creating PSObjects
    ToDo: Clean up the UserSID Translation, to continue even if the SID is local
    #>
    [CmdletBinding()]
    param(
    [Parameter(Position=0,ValueFromPipeline=$true)]
    [Alias("CN","Computer")]
    [String[]]$ComputerName="$env:COMPUTERNAME",
    [String]$FilterSID,
    [String]$WQLFilter="NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
    Begin
    #Adjusting ErrorActionPreference to stop on all errors
    $TempErrAct = $ErrorActionPreference
    $ErrorActionPreference = "Stop"
    #Exclude Local System, Local Service & Network Service
    }#End Begin Script Block
    Process
    Foreach ($Computer in $ComputerName)
    $Computer = $Computer.ToUpper().Trim()
    Try
    #Querying Windows version to determine how to proceed.
    $Win32OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer
    $Build = $Win32OS.BuildNumber
    #Win32_UserProfile exist on Windows Vista and above
    If ($Build -ge 6001)
    If ($FilterSID)
    $WQLFilter = $WQLFilter + " AND NOT SID = `'$FilterSID`'"
    }#End If ($FilterSID)
    $Win32User = Get-WmiObject -Class Win32_UserProfile -Filter $WQLFilter -ComputerName $Computer
    $LastUser = $Win32User | Sort-Object -Property LastUseTime -Descending | Select-Object -First 1
    $Loaded = $LastUser.Loaded
    $Script:Time = ([WMI]'').ConvertToDateTime($LastUser.LastUseTime)
    #Convert SID to Account for friendly display
    $Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($LastUser.SID)
    $User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
    }#End If ($Build -ge 6001)
    If ($Build -le 6000)
    If ($Build -eq 2195)
    $SysDrv = $Win32OS.SystemDirectory.ToCharArray()[0] + ":"
    }#End If ($Build -eq 2195)
    Else
    $SysDrv = $Win32OS.SystemDrive
    }#End Else
    $SysDrv = $SysDrv.Replace(":","$")
    $Script:ProfLoc = "\\$Computer\$SysDrv\Documents and Settings"
    $Profiles = Get-ChildItem -Path $Script:ProfLoc
    $Script:NTUserDatLog = $Profiles | ForEach-Object -Process {$_.GetFiles("ntuser.dat.LOG")}
    #Function to grab last profile data, used for allowing -FilterSID to function properly.
    function GetLastProfData ($InstanceNumber)
    $Script:LastProf = ($Script:NTUserDatLog | Sort-Object -Property LastWriteTime -Descending)[$InstanceNumber]
    $Script:UserName = $Script:LastProf.DirectoryName.Replace("$Script:ProfLoc","").Trim("\").ToUpper()
    $Script:Time = $Script:LastProf.LastAccessTime
    #Getting the SID of the user from the file ACE to compare
    $Script:Sddl = $Script:LastProf.GetAccessControl().Sddl
    $Script:Sddl = $Script:Sddl.split("(") | Select-String -Pattern "[0-9]\)$" | Select-Object -First 1
    #Formatting SID, assuming the 6th entry will be the users SID.
    $Script:Sddl = $Script:Sddl.ToString().Split(";")[5].Trim(")")
    #Convert Account to SID to detect if profile is loaded via the remote registry
    $Script:TranSID = New-Object System.Security.Principal.NTAccount($Script:UserName)
    $Script:UserSID = $Script:TranSID.Translate([System.Security.Principal.SecurityIdentifier])
    }#End function GetLastProfData
    GetLastProfData -InstanceNumber 0
    #If the FilterSID equals the UserSID, rerun GetLastProfData and select the next instance
    If ($Script:UserSID -eq $FilterSID)
    GetLastProfData -InstanceNumber 1
    }#End If ($Script:UserSID -eq $FilterSID)
    #If the detected SID via Sddl matches the UserSID, then connect to the registry to detect currently loggedon.
    If ($Script:Sddl -eq $Script:UserSID)
    $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"Users",$Computer)
    $Loaded = $Reg.GetSubKeyNames() -contains $Script:UserSID.Value
    #Convert SID to Account for friendly display
    $Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($Script:UserSID)
    $User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
    }#End If ($Script:Sddl -eq $Script:UserSID)
    Else
    $User = $Script:UserName
    $Loaded = "Unknown"
    }#End Else
    }#End If ($Build -le 6000)
    #Creating Custom PSObject For Output
    New-Object -TypeName PSObject -Property @{
    Computer=$Computer
    User=$User
    SID=$Script:UserSID
    Time=$Script:Time
    CurrentlyLoggedOn=$Loaded
    } | Select-Object Computer, User, SID, Time, CurrentlyLoggedOn
    }#End Try
    Catch
    If ($_.Exception.Message -Like "*Some or all identity references could not be translated*")
    Write-Warning "Unable to Translate $Script:UserSID, try filtering the SID `nby using the -FilterSID parameter."
    Write-Warning "It may be that $Script:UserSID is local to $Computer, Unable to translate remote SID"
    Else
    Write-Warning $_
    }#End Catch
    }#End Foreach ($Computer in $ComputerName)
    }#End Process
    End
    #Resetting ErrorActionPref
    $ErrorActionPreference = $TempErrAct
    }#End End
    }# End Function Get-LastLogon

     This should work:
    Get-LastLogon -Computername (Get-content .\Servers.txt) | Export-CSV .\Output.csv -NoTypeInformation
    I just tested it on my test domain and it did the trick.

  • 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");

  • 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

  • [Solved] Could someone that knows awk good fix this script for me?

    I found this script on the linuxquestions site that tests and displays network bandwidth.  There's an error in the script though and my awk experience isn't enough to debug it and is giving me the error:
    awk: cmd. line:10: printf ("%4.0f", Ratio)}
    awk: cmd. line:10: ^ syntax error
    awk: cmd. line:10: printf ("%4.0f", Ratio)}
    awk: cmd. line:10: ^ syntax error
    ^C/home/todd/.bin/bandwidth-test: line 21: [: : integer expression expected
    BW Surchargé - Moyenne de de Kb/sec pendant 20 secondes
    This is the script:
    #!/bin/bash
    # bandwidth-test - test bandwidth from the command line
    Fic_Tmp="/tmp/Fic_Tmp_VerifRatio.tmp"
    NbrSec=20
    /usr/bin/bwm-ng -I eth0 -o csv -T avg -C " " -c ${NbrSec} | awk '
    BEGIN{
    BytesS=0
    NbrLecture=0}
    /eth0/&&NR>2{
    BytesS+=$5/1024
    NbrLecture+=1}
    END{
    Ratio=BytesS/NbrLecture
    printf ("%4.0f", Ratio)}' > ${Fic_Tmp}
    Ratio=$(cat ${Fic_Tmp})
    rm ${Fic_Tmp}
    if [ "${Ratio}" -lt 110 ];then
    echo "BW OK - Moyenne de ${Ratio} de Kb/sec pendant ${NbrSec} secondes"
    exit 0
    else
    echo "BW Surchargé - Moyenne de ${Ratio} de Kb/sec pendant ${NbrSec} secondes"
    exit 2
    fi
    exit $?
    Anyone available to fix this for me?
    Last edited by Gen2ly (2009-11-17 17:52:14)

    Ah, thought I counted all those.  Whoops .  Yep that did the trick.  Thanks benob.
    Edit: Just FYI to any that read this.  This script only checks if you are in the cap range, so it's not really a bandwidth tester for the command line.  The nearest I've found is 'iperf' which I'm unable to get to use yet.
    Edit2 : netperf seems better suited for this, only been able to learn how to do download speed test so far:
    netperf -c hostname -f K
    Last edited by Gen2ly (2009-11-17 19:08:38)

  • EDITING SQL SCRIPT IN CRYSTAL REPORTS

    I just installed Version 12 and am trying to edit SQL scripts in Crystal Reports that were created in Version 8.  When opening the Database tab on the Main Menu, the Query Panel is greyed out and not accessible.  I can view the SQL Query but cannot edit it.  If someone can advise me what to do I would be very appreciative.
    Edited by: Frank Romano on Mar 18, 2009 4:17 PM

    Hi Frank,
    Here is the SAP Note that says that you cannot edit SQL from Crystal 9 and later
    Symptom
    In Crystal Reports (CR) 8.5 and earlier, it is possible to edit the SQL statement in the 'Show SQL Query' dialog box. Doing so allows the report designer to modify the SQL statement that CR generates. Starting with Crystal Reports version 9, users are no longer able to modify the SQL in the 'Show SQL Query' window.
    How can you control the SQL statement that Crystal Reports sends to the database?
    Resolution
    To control the SQL statement that Crystal Reports 9 and later uses, use the 'Add Command' feature to create a Command Object. The 'Add Command' feature replaces the ability to edit SQL statements in the 'Show SQL Query' dialog box. Use this dialog box to write your own SQL command (query) which will be represented in Crystal Reports as a Table object.
    More Information
    Additional information about creating and using Command Objects ('Add Command') can be found on our support site and within the Online Help file contained in Crystal Reports.
    On our support site search for the technical brief, cr_query_engine.pdf and knowledge base article c2016641 at
    http://support.businessobjects.com/search
    Keywords
    OBJECT ADD COMMAND EDIT SHOW SQL QUERY DATABASE ACCESS MENU MODIFY SQL Crystal Reports Show SQL query Command object , c2017389
    Regards,
    Raghavendra

  • Can this script be converted to a UNIX command for ARD?

    First I'd like to thank "Neil" again for providing the script below:
    set the_versions to (do shell script "mdls -name kMDItemVersion /Applications/Microsoft\\ Office\\ 2011/Microsoft\\ Excel.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Adobe\\ Reader.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Safari.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Google\\ Chrome.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Adobe\\ Acrobat\\ X\\ Pro/Adobe\\ Acrobat\\ Pro.app")
    set the_versions to the_versions & return & (do shell script "SW_vers")
    Output for this script yields exactly what I requested in the thread.  Ex:
    "kMDItemVersion = \"14.4.1\"
    kMDItemVersion = \"11.0.07\"
    kMDItemVersion = \"7.0.4\"
    kMDItemVersion = \"35.0.1916.114\"
    kMDItemVersion = \"10.1.10\"
    ProductName:          Mac OS X
    ProductVersion:          10.9.3
    BuildVersion:          13D65"
    I'd like to be able to run this command (or a variation) in Apple Remote Desktop (ARD) remotely, and as a UNIX command in order to generate a similar ARD report if possible.  Even better, I'd like the report to include the Application name and I'd like it to not to halt if an Application isn't present. My guess is that functionality like this for ARD would help a LOT of ARD Administrators because it would seem that the only way to do anything similar is to derive the metadata piecemeal (machine by machine) or end up having to wade through a ton of unwanted content using a full System Report...  Thanks.

    Forum software NOW prevents posting complete shell scripts. You'll have to piece together the code.
    First build an array of the applications that you are looking for in this form. Note; I truncated the applications.
    apps=( "/Applications/Microsoft Office 2011/Microsoft Excel.app" "/Applications/Adobe Reader.app" "/Applications/Safari.app" )
    Next loop thru the array
    for i in "${apps[@]}"; do
         printf "%s: %s\n" "$i" "$(mdls -name kMDItemVersion "$i")"
    done
    If you want to create a report then change the above loop to the following
    for i in "${apps[@]}"; do
         printf "%s: %s\n" "$i" "$(mdls -name kMDItemVersion "$i")"
    done > app_report.txt
    sw_vers >> app_report.txt
    Message was edited by: Mark Jalbert

  • Run script action - ZCM edits my script's content

    Good day,
    I am implementing a script in a bundle that allows me to generate files on the fly and execute them. Upon saving my "run script" action, ZENworks takes on himself to parse and edit my script, I am not sure why.
    A part of my script generates a .hta file, an html application, that is used as a temporary splash screen. For some reason (line 85) my event name (Windows_onLoad()) is renamed by ZENworks like this :
    oFile.WriteLine " Sub Window_onload()"
    becomes
    oFile.WriteLine " Sub Window_<body <body <body <body <body onload()"
    Does that ring a bell for anyone?
    I have other means of doing what I want but I wanted to bring this specific issue to you. Let me know what you think.
    Thank you!
    Action parameters :
    Code:
    Script to run : 'Define oyur own script'
    Script content : *copy of the script found below*
    Script file extention : .vbs
    Path to script Engine : C:\Windows\system32\wscript.exe
    Executable security level : Run as dynamic administrator
    Requirements : Registry Key and Value exists
    \HKEY_LOCAL_MACHINE\SOFTWARE\Lafleche\ZenworksAssignedObjets - Inst-Coba-x64 - NO
    ZENworks Agent : 11.2.2.121992 & 11.2.3.18535
    ZENworks version : 11.2.3.0
    Code:
    set oFSO = CreateObject("Scripting.FileSystemObject")
    set oShell = CreateObject("WScript.Shell")
    strFileName1 = Replace(oFSO.GetTempName,".tmp",".reg")
    strFileName2 = oFSO.GetTempName
    strFileName3 = Replace(oFSO.GetTempName,".tmp",".hta")
    set oFile = oFSO.CreateTextFile(strFileName3)
    oFile.WriteLine "<!DOCTYPE html>"
    oFile.WriteLine "<html>"
    oFile.WriteLine " <head>"
    oFile.WriteLine " <title>Title</title>"
    oFile.WriteLine " <HTA:APPLICATION Caption=""yes"" SysMenu=""yes"" />"
    oFile.WriteLine " <script language=""VBScript"">"
    oFile.WriteLine ""
    oFile.WriteLine " Sub Window_onload()"
    oFile.WriteLine " "
    oFile.WriteLine " window.resizeTo 500,250"
    oFile.WriteLine " "
    oFile.WriteLine " strComputer = ""."""
    oFile.WriteLine " Set objWMIService = GetObject(""winmgmts:\\"" & strComputer & ""\root\cimv2"")"
    oFile.WriteLine " Set colItems = objWMIService.ExecQuery(""Select * From Win32_DesktopMonitor"")"
    oFile.WriteLine " "
    oFile.WriteLine " For Each objItem in colItems "
    oFile.WriteLine " intHorizontal = objItem.ScreenWidth"
    oFile.WriteLine " intVertical = objItem.ScreenHeight "
    oFile.WriteLine " Next"
    oFile.WriteLine " "
    oFile.WriteLine " intLeft = (intHorizontal - 500) / 2"
    oFile.WriteLine " intTop = (intVertical - 250) / 2"
    oFile.WriteLine " window.moveTo intLeft, intTop "
    oFile.WriteLine " idTimer = window.setTimeout(""PausedSection"", 8000, ""VBScript"")"
    oFile.WriteLine " "
    oFile.WriteLine " End Sub"
    oFile.WriteLine " "
    oFile.WriteLine " Sub PausedSection"
    oFile.WriteLine " window.close"
    oFile.WriteLine " End Sub"
    oFile.WriteLine ""
    oFile.WriteLine " </script>"
    oFile.WriteLine " </head>"
    oFile.WriteLine " <body>"
    oFile.WriteLine " "
    oFile.WriteLine " <img src=""http://www.domain.com/logo.png"" alt="""" />"
    oFile.WriteLine " "
    oFile.WriteLine " <p>Installation underway...</p>"
    oFile.WriteLine " "
    oFile.WriteLine " </body>"
    oFile.WriteLine "</html>"
    oFile.Close
    oShell.Run strFileName3, 0, true
    'oFSO.DeleteFile strFileName3

    Hi All, we now have the same issue. running 11.2.4 MU1 tested on IE8 on XP, IE9 on Win7 and ff 17esr, and suse 12.3 with chrome 31... want us to try ie 10 and 11? currently updating to ff 24 esr, and will update IE to 10 for now.
    Currently we have the exe defined as "c:\windows\system32\mshta.exe", .hta extension.
    Trying to validate the syntax externally, if anyone has any suggestions. Encrypted within the script the app runs fine.
    issue is the <body being added, up to several times:
    "Sub Window_<body <body <body onload
    Window.ResizeTo 590,560
    Continue
    End Sub"

  • Adobe FP 10-A Script in this movie is causing Adobe FP 10 to run slowly. If it continues to run your computer may become unresponsive. Do you want to abort this script? yes or no. How do I fix this crash?

    Adobe FP 10-A Script in this movie is causing Adobe FP 10 to run slowly. If it continues to run your computer may become unresponsive. Do you want to abort this script? yes or no. How do I fix this crash?

    Hi,
    Some "movies' are actually Flash files.
    This means the Flash App will play them (possibly in a browser in some cases).
    Depending where this item is and how it is playing it may be effected by other things
    A web page can include javascript.
    Apple uses javascript here to help with creating the posting box, the Edit options, Adding pics/smilies and the like.
    Sometimes the javascript can be what is called a runaway process and gets sort of stuck in an endless loop.
    If it is a free standing item then it might be triggered by AppleScript on the Mac. (or be modified in some way)
    Again if the Script (normally written with a upper case S) is not perfect it can cause problems.
    9:09 pm      Wednesday; February 26, 2014
      iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • How disable JSF2 edit my script tag?

    I am using jsf2. Problem is the script tag being edited to append closing script tag. It cause the jquery not work(I also not sure why but it does not work when i come with closing tag). How to disable jsf to format my script tag?
    original
    <script src="/jquery/menu/demo/jquery.dimensions.min.js"/>
    output
    <script src="/jquery/menu/demo/jquery.dimensions.min.js"><!--
    //--></script>

    am not sure, try with this
    <script src="/jquery/menu/demo/jquery.dimensions.min.js" type="text/javascript" > </script>

  • Please edit my script to get specific measurements?

    Please edit my script to get specific measurements?
    Hi Guys,
    I do have script, which gives specific measurements of selected objects. This is working great. But I need the following requirements.
    ·      Size should come exactly. That means the selected object is 10.4mm. But this script is measuring as 10mm, which is not correct exactly.
    ·      Color should be following.
    o   Measurement line color with ‘XYZ’ PMS
    o   Measurement text color with ‘ABC’ PMS
    Here is the script of that.
    Thanks in advance...
    Kind Regards
    HARI

    Here is the script of that..
    * Description: An Adobe Illustrator script that automates measurements of objects. This is an early version that has not been sufficiently tested. Use at your own risks.
    * Usage: Select 1 to 2 page items in Adobe Illustrator, then run this script by selecting File > Script > Other Scripts > (choose file)
    * License: GNU General Public License Version 3. (http://www.gnu.org/licenses/gpl-3.0-standalone.html)
    * Copyright (c) 2009. William Ngan.
    * http://www.metaphorical.net
    // Create an empty dialog window near the upper left of the screen
    var dlg = new Window('dialog', 'Spec');
    dlg.frameLocation = [100,100];
    dlg.size = [250,250];
    dlg.intro = dlg.add('statictext', [20,20,150,40] );
    dlg.intro.text = 'First select 1 or 2 items';
    dlg.where = dlg.add('dropdownlist', [20,40,150,60] );
    dlg.where.selection = dlg.where.add('item', 'top');
    dlg.where.add('item', 'bottom');
    dlg.where.add('item', 'left');
    dlg.where.add('item', 'right');
    dlg.btn = dlg.add('button', [20,70,150,90], 'Specify', 'spec');
    // document
    var doc = activeDocument;
    // spec layer
    try {
        var speclayer =doc.layers['spec'];
    } catch(err) {
        var speclayer = doc.layers.add();
        speclayer.name = 'spec';
    // measurement line color
    var color = new CMYKColor;
    color.cyan = 0;
    color.magenta = 0;
    color.yellow = 0;
    color.black = 100;
    // gap between measurement lines and object
    var gap = 10;
    // size of measurement lines.
    var size = 10;
    // number of decimal places
    var decimals = 0;
    // pixels per inch
    var dpi = 72;
        Start the spec
    function startSpec() {
        if (doc.selection.length==1) {
            specSingle( doc.selection[0].geometricBounds, dlg.where.selection.text );
        } else if (doc.selection.length==2) {
            specDouble( doc.selection[0], doc.selection[1], dlg.where.selection.text );
        } else {
                alert('please select 1 or 2 items');
        dlg.close ();
        Spec the gap between 2 elements
    function specDouble( item1, item2, where ) {
        var bound = new Array(0,0,0,0);
        var a =  item1.geometricBounds;
        var b =  item2.geometricBounds;
        if (where=='top' || where=='bottom') {
            if (b[0]>a[0]) { // item 2 on right,
                if (b[0]>a[2]) { // no overlap
                    bound[0] =a[2];
                    bound[2] = b[0];
                } else { // overlap
                    bound[0] =b[0];
                    bound[2] = a[2];
            } else if (a[0]>=b[0]){ // item 1 on right
                if (a[0]>b[2]) { // no overlap
                    bound[0] =b[2];
                    bound[2] = a[0];
                } else { // overlap
                    bound[0] =a[0];
                    bound[2] = b[2];
            bound[1] = Math.max (a[1], b[1]);
            bound[3] = Math.min (a[3], b[3]);
        } else {
            if (b[3]>a[3]) { // item 2 on top
                if (b[3]>a[1]) { // no overlap
                    bound[3] =a[1];
                    bound[1] = b[3];
                } else { // overlap
                    bound[3] =b[3];
                    bound[1] = a[1];
            } else if (a[3]>=b[3]){ // item 1 on top
                if (a[3]>b[1]) { // no overlap
                    bound[3] =b[1];
                    bound[1] = a[3];
                } else { // overlap
                    bound[3] =a[3];
                    bound[1] = b[1];
            bound[0] = Math.min(a[0], b[0]);
            bound[2] = Math.max (a[2], b[2]);
        specSingle(bound, where );
        spec a single object
        @param bound item.geometricBound
        @param where 'top', 'bottom', 'left,' 'right'
    function specSingle( bound, where ) {
        // width and height
        var w = bound[2]-bound[0];
        var h = bound[1]-bound[3];
        // a & b are the horizontal or vertical positions that change
        // c is the horizontal or vertical position that doesn't change
        var a = bound[0];
        var b = bound[2];
        var c = bound[1];
        // xy='x' (horizontal measurement), xy='y' (vertical measurement)
        var xy = 'x';
        // a direction flag for placing the measurement lines.
        var dir = 1;
        switch( where ) {
            case 'top':
                a = bound[0];
                b = bound[2];
                c = bound[1];
                xy = 'x';
                dir = 1;
                break;
            case 'bottom':
                a = bound[0];
                b = bound[2];
                c = bound[3];
                xy = 'x';
                dir = -1;
                break;
            case 'left':
                a = bound[1];
                b = bound[3];
                c = bound[0];
                xy = 'y';
                dir = -1;
                break;
            case 'right':
                a = bound[1];
                b = bound[3];
                c = bound[2];
                xy = 'y';
                dir = 1;
                break;
        // create the measurement lines
        var lines = new Array();
        // horizontal measurement
        if (xy=='x') {
            // 2 vertical lines
            lines[0]= new Array( new Array(a, c+(gap)*dir) );
            lines[0].push ( new Array(a, c+(gap+size)*dir) );
            lines[1]= new Array( new Array(b, c+(gap)*dir) );
            lines[1].push( new Array(b, c+(gap+size)*dir) );
            // 1 horizontal line
            lines[2]= new Array( new Array(a, c+(gap+size/2)*dir ) );
            lines[2].push( new Array(b, c+(gap+size/2)*dir ) );
            // create text label
            if (where=='top') {
                var t = specLabel( w, (a+b)/2, lines[0][1][1] );
                t.top += t.height;
            } else {
                var t = specLabel( w, (a+b)/2, lines[0][0][1] );
                t.top -= t.height;
            t.left -= t.width/2;
        // vertical measurement
        } else {
            // 2 horizontal lines
            lines[0]= new Array( new Array( c+(gap)*dir, a) );
            lines[0].push ( new Array( c+(gap+size)*dir, a) );
            lines[1]= new Array( new Array( c+(gap)*dir, b) );
            lines[1].push( new Array( c+(gap+size)*dir, b) );
            //1 vertical line
            lines[2]= new Array( new Array(c+(gap+size/2)*dir, a) );
            lines[2].push( new Array(c+(gap+size/2)*dir, b) );
            // create text label
            if (where=='left') {
                var t = specLabel( h, lines[0][1][0], (a+b)/2 );
                t.left -= t.width;
            } else {
                var t = specLabel( h, lines[0][0][0], (a+b)/2 );
                t.left += size;
            t.top += t.height/2;
        // draw the lines
        var specgroup = new Array(t);
        for (var i=0; i<lines.length; i++) {
            var p = doc.pathItems.add();
            p.setEntirePath ( lines[i] );
            setLineStyle( p, color );
            specgroup.push( p );
        group(speclayer, specgroup );
        Create a text label that specify the dimension
    function specLabel( val, x, y) {
            var t = doc.textFrames.add();
            t.textRange.characterAttributes.size = 8;
            t.textRange.characterAttributes.alignment = StyleRunAlignmentType.center;
            var v = val;
            switch (doc.rulerUnits) {
                case RulerUnits.Inches:
                    v = val/dpi;
                    v = v.toFixed (decimals);
                    break;
                case RulerUnits.Centimeters:
                    v = val/(dpi/2.54);
                    v = v.toFixed (decimals);
                    break;
                case RulerUnits.Millimeters:
                    v = val/(dpi/25.4);
                    v = v.toFixed (decimals);
                    break;
                case RulerUnits.Picas:
                    v = val/(dpi/6);
                    var vd = v - Math.floor (v);
                    vd = 12*vd;
                    v =  Math.floor(v)+'p'+vd.toFixed (decimals);
                    break;
                default:
                    v = v.toFixed (decimals);
            t.contents = v;
            t.top = y;
            t.left = x;
            return t;
    function setLineStyle(path, color) {
            path.filled = false;
            path.stroked = true;
            path.strokeColor = color;
            path.strokeWidth = 0.5;
            return path;
    * Group items in a layer
    function group( layer, items, isDuplicate) {
        // create new group
        var gg = layer.groupItems.add();
        // add to group
        // reverse count, because items length is reduced as items are moved to new group
        for(var i=items.length-1; i>=0; i--) {
            if (items[i]!=gg) { // don't group the group itself
                if (isDuplicate) {
                    newItem = items[i].duplicate (gg, ElementPlacement.PLACEATBEGINNING);
                } else {
                    items[i].move( gg, ElementPlacement.PLACEATBEGINNING );
        return gg;
    dlg.btn.addEventListener ('click', startSpec );
    dlg.show();

Maybe you are looking for

  • HT4623 I update my new iphone with the data of my old iphone.  Now every email is post twice.  Can someone tell me how to correct that from happening?

    I purchase a new iphone.  I backed up my old iphone and moved the data to my new iphone.  My new iphone shows my emails twice every time a new email comes up.  How can I correct this issue?

  • Oracle 8.1.6 on Mandrake 7.2?

    Has anyone been able to get the Universal Installer to work on Mandrake 7.2? It starts on my box, but then none of the buttons in the lower bar (Exit, Help, Installed products, Previous, and Next) work. It's weird, because if I click on "About Oracle

  • Silently Uninstalling Adobe Reader 9

    Hi all, I am looking to silently uninstall Adobe Reader 9 due to the same exact problems posted in the below link: http://www.adobeforums.com/webx/.59b5c482 *It's the C++ Visual Runtime Error due to the appdata folder redirection. Does anyone have a

  • Data, Original and Modified folders?

    sorry, this may be a dumb question, but what's the difference between Data, Original and Modified folders? when I do a search for a specific folder, i find that I will find all the folders and there looks like duplicates but they are filed in Data, O

  • Appearance of black in Bridge cs4

    I set the appearance of black in illustrator to "display all blacks as rich black" and "output all blacks as rich black". when displaying the previews of these files in bridge they only display backs "accurately" or in "100k black". This also happens