Script to find name of swatch pattern of selected item

I'm confused on the code to find the name of swatch pattern of selected item. As an example, the following code works to find the name of a selected item.
var newItem;
var docSelected = app.activeDocument.selection;
if ( docSelected.length > 0 ) {
for ( i = 0; i < docSelected.length; i++ ) {
var swatchRefName=docSelected[i].name;
alert(swatchRefName);
else {
alert( "Please select one or more art objects" );
To find the swatch name, my idea would be to change
var swatchRefName=docSelected[i].swatch.name;
obviously this doesn't work or many other versions I've tried, Can any one help? Thank You.

Hi Basva,
There might be an easier way, but this should work:
foreach($item in $list.Items)
$minor = 0
$major = 0
foreach($version in $item.Versions)
if($version.Level -eq "Draft")
$minor += 1
else #Assume Level must be Published
$major += 1
#The variables $minor and $major will now hold
#the correct number of versions for this item

Similar Messages

  • A script to create a new folder and place selected items into it?

    I'd like to select a few items and have either an Apple script / contextual menu automatically create a new folder and place the selected items inside it.
    I have many, many to do—which is why I wanted to know if there is a script or automator or contextual menu thing available. Or if not, how can I create one?
    Can that be done? Thank you!

    Thank you for your help. Now I just want to expand on this a bit. To use the Applescript you have supplied me, how do I tell it to name the folder other than by date, and where to put it?
    Let me say, preferably, is it possible to make an action like this right-clickable? Instead of having to pick a script. Anything that slows this process down means I might as well do it all by hand. What I'd really love to do is this:
    Select a number of items. Right click to an action saying "create a new folder and put this items in it. Name the folder with the first item's name". Very simple and quick.
    Could this be accomplished? Through Automator? or something that can appear in the contextual menu? Folder actions?
    I'm just getting started with using these tools.

  • A Script to Find and Replace Layer Names

    Are there any scripts to find and replace layer names?
    There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers.
    The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.
    Ideally, it would be great if there was something that could do multiple find and replaces in one go:
    (e.g.
    You have layers like this Car, Dog, Bat
    You enter: car(Option1), dog(Option2), Bat(Option3)
    Your layers then become: Option1, Option2, Option3).

    big_smile, that's a very good start! Step 1 of Learning How To Script is indeed, adjusting an existing simple script to make it do more complicated things. (And usually then "break something", which is also a required part of the process.)
    You are correct in your observation this is repetitive stuff. For one or two different items that wouldn't be a problem, but in longer lists you soon get lost.
    The usual way of working with find-change lists is to build an array:
    var layernames = [
    [ 'FHairBowlBoy *Hair', 'Hairboy1' ],
    [ 'FHairCurlyafroBoy *Hair', 'Hairboy2' ],
    [ 'FHairSpikyBoy *Hair', 'Hairboy3' ],
    The general idea is to loop over all names, check if the current layer name is "layernames[i][0]" (the left column) and if so, rename it to "layernames[i][1]" (the right column). If you know how to write a loop in Javascript, then you can implement this right away.
    However ..
    A more advanced way to do this doesn't even need loop to over all layernames -- instead you can immediately "get" the correct name per layer! It's magic! Almost!
    The trick is to use a Javascript object instead of an array. Javascript objects are nothing special; Illustrator's 'layers' is an array of objects, and each object "layer" has a property "name", whose value you can read and set. What I do here is create a new object, where the "name" part is the original layer name and its value is the new layer name. All you need to check for per each layer is if there is a property 'object.originalLayerName', and if so, assign its value to that layer name.
    This looks a bit like the array above, except that (1) you use {..} instead of [..] to create an object, and (2) you add "name:value" pairs instead of "value" only (actually, the 'name' of a value in an array is simply its number).
    So this is what it looks like:
    // JavaScript Document
    var doc = app.activeDocument;
    // name indexed object
    var layernames = {
    'FHairBowlBoy *Hair':'Hairboy1',
    'FHairCurlyafroBoy *Hair':'Hairboy2',
    'FHairSpikyBoy *Hair':'Hairboy3'
    // loop through all layers
    for (var i = 0; i < doc.layers.length; i++)
    //Set up Variable to access layer name
    var currentLayer = app.activeDocument.layers[i];
    if (layernames[currentLayer.name])
      currentLayer.name = layernames[currentLayer.name];
    Enjoy!

  • Script to find files with same names with in a folder and it sub folders.

    Looking for script to find files with same names with in a folder and it sub folders.

    Are you just looking to find if any two files underneath a folder have the same name?
    If you just want to know that a file named "whatever" exists in two folders, that's not too difficult, but you probably want to know the full path names.
    Here's one attempt:
    $ perl -MFile::Find -le 'find(\&w, "."); while (($n,$p)=each %file) {if(@{$p}>1){print join(" ",@{$p})}} sub w{push @{$file{$_}},$File::Find::name;}'That will print the pathnames on the same line of any files with the same name that appear anywhere underneath your current directory.
    It's a bit long for a "one-liner", but functional.
    Darren

  • Script to find OU name and object name in AD

    Hi , can any one help me on this, I need a script to find OU name along with object name in entire domain.
    Regards, Triyambak

    Hi Triyambak,
    As DexterPOSH mentioned, Get-ADObject can be used here.
    To list all OUs and the relevant objects of each OU in domain, please try the script below:
    Import-Module ActiveDirectory
    Get-ADOrganizationalUnit -Filter *|foreach{
    Get-ADObject -SearchBase $_.DistinguishedName -Filter *}
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

  • Recording Action for Swatch Pattern creation

    Hi !
    I'd like to record an action in Illustrator CS6 for adding a swatch pattern but I have a problem for specifying options.
    Here is what I do :
    Open a document containing (for instance) a rectangle filled with what will become my new swatch pattern.
    Go in Window > Actions. Add new action, name it and start record.
    Select All
    In Action window menu, select "Insert menu Item"
    Go to Object > Pattern > Make
    This is all fine at that point. The swatch is created and I can find it in the swatches window. The problem is I'd like to record a change in the "Pattern Options" window (changing default Copies from 5x5 to 1x1).
    I can't record this last action.
    Would anybody have an idea on how to do this ? If it's not possible via actions, is it possible via js scripting ?
    Thanks in advance,
    Jim

    Intrestingly enough when I record the Action in CC the Action looks like this:
    Then I quit Illustrator CC and launch again and the Action no longer works. Here is what the Action looks like in the Actions Panel after quiting Illustrator and launching it again:
    The Select All Unused goes away. Curiouser and curiouser.

  • Script to find duplicate index and how can we tell if an index is REALLY a duplicate?

    Does any one have script to find duplicate index? and how can we tell if an index is REALLY a duplicate?
    Rahul

    One more written by Itzik Ben-Gan
    The first query finds exact matches. The indexes must have 
    the same key columns in the same order, and the same included columns but in any order. 
    These indexes are sure targets for elimination. The only caution would be to check for index hints. 
    -- exact duplicates
    with indexcols as
    select object_id as id, index_id as indid, name,
    (select case keyno when 0 then NULL else colid end as [data()]
    from sys.sysindexkeys as k
    where k.id = i.object_id
    and k.indid = i.index_id
    order by keyno, colid
    for xml path('')) as cols,
    (select case keyno when 0 then colid else NULL end as [data()]
    from sys.sysindexkeys as k
    where k.id = i.object_id
    and k.indid = i.index_id
    order by colid
    for xml path('')) as inc
    from sys.indexes as i
    select
    object_schema_name(c1.id) + '.' + object_name(c1.id) as 'table',
    c1.name as 'index',
    c2.name as 'exactduplicate'
    from indexcols as c1
    join indexcols as c2
    on c1.id = c2.id
    and c1.indid < c2.indid
    and c1.cols = c2.cols
    and c1.inc = c2.inc;
    The second variation of this query finds partial, or duplicate, indexes 
    that share leading key columns, e.g. Ix1(col1, col2, col3) and Ix2(col1, col2) 
    would be considered duplicate indexes. This query only examines key columns and does not consider included columns. 
    These types of indexes are probable dead indexes walking. 
    -- Overlapping indxes
    with indexcols as
    select object_id as id, index_id as indid, name,
    (select case keyno when 0 then NULL else colid end as [data()]
    from sys.sysindexkeys as k
    where k.id = i.object_id
    and k.indid = i.index_id
    order by keyno, colid
    for xml path('')) as cols
    from sys.indexes as i
    select
    object_schema_name(c1.id) + '.' + object_name(c1.id) as 'table',
    c1.name as 'index',
    c2.name as 'partialduplicate'
    from indexcols as c1
    join indexcols as c2
    on c1.id = c2.id
    and c1.indid < c2.indid
    and (c1.cols like c2.cols + '%' 
    or c2.cols like c1.cols + '%') ;
    Be careful when dropping a partial duplicate index if the two indexes differ greatly in width. 
    For example, if Ix1 is a very wide index with 12 columns, and Ix2 is a narrow two-column index 
    that shares the first two columns, you may want to leave Ix2 as a faster, tighter, narrower index.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • PS Script to find the list of users and the groups in a Workgroup server

    Hi There, could you please explain on how to get a complete list of local users and local groups in a "Workgroup" server to which they belong to using Powershell. I'm able to get the users list but couldn't find any help in finding
    the script to find to which localgroup the user belong to. Anticipating your response. Also let me know the cmdlet for Win2k3 servers to find the same.

    Here's some code from David Pham (don't remember wher I fund this code):
    Trap {"Error: $_"; Break;}
    Function EnumLocalGroup($LocalGroup)
    $Group = [ADSI]"WinNT://$strComputer/$LocalGroup,group"
    "Group: $LocalGroup"
    # Invoke the Members method and convert to an array of member objects.
    $Members= @($Group.psbase.Invoke("Members"))
    ForEach ($Member In $Members)
    $Name = $Member.GetType().InvokeMember("Name", 'GetProperty', $Null, $Member, $Null)
    $Name
    # Specify the computer.
    $strComputer = gc env:computername
    "Computer: $strComputer"
    $computer = [adsi]"WinNT://$strComputer"
    $objCount = ($computer.psbase.children | measure-object).count
    $i=0
    foreach($adsiObj in $computer.psbase.children)
    switch -regex($adsiObj.psbase.SchemaClassName)
    "group"
    { $group = $adsiObj.name
    EnumLocalGroup $group }
    } #end switch
    $i++
    } #end foreach

  • Help. New to scripting!  Find registration colors used

    Hi!
    i have this script to find registration colors.... but when run in ESTK. it show errors on the below highlighted....
    could anyone help out this!
    error it throws is:
    function myCheckForRegistration(myEvent){
    var myRegistrationSwatchUsed = false;
    if(app.selection.length != 0){
    for(var myCounter = 0; myCounter < app.selection.length; myCounter++){
    if((app.documents.item(0).selection[myCounter].fillColor ==
    app.documents.item(0).swatches.item("Registration"))||
    (app.documents.item(0).selection[myCounter].strokeColor ==
    app.documents.item(0).swatches.item("Registration")){                    error is: // expected:)
    myRegistrationSwatchUsed = true;
    if(myRegistrationSwatchUsed == true){
    alert("The Registration swatch is applied to some of the\robjects in the selection. Did you really intend to apply this swatch?");
    thanks
    shil..

    hellow lauv!!!
    i tried your command....
    ungrouped the object.item(n) between OR....
    function myCheckForRegistration(myEvent){
    var myRegistrationSwatchUsed = false;
    if(app.selection.length != 0){
    for(var myCounter = 0; myCounter < app.selection.length; myCounter++){
    if(app.documents.item(0).selection[myCounter].fillColor ==app.documents.item(0).swatches.item("Registration")||
    (app.documents.item(0).selection[myCounter].strokeColor ==app.documents.item(0).swatches.item("Registration")){                   //  error is: expected:)
    myRegistrationSwatchUsed = true};
    if(myRegistrationSwatchUsed == true){
    alert("The Registration swatch is applied to some of the\robjects in the selection. Did you really intend to apply this swatch?");
    the error is:
    thanks for fastidious care on my script....
    shall i wait for the reply...
    shil!

  • Script to find out that users do not have inheritable permission checked

    Hi all,
    I just check our AD (windows 2003 R2) and some users have "allow inheritable permissions from the parent to propagate to this object and all child objects.  include these with entries expilitly defined here" checked  if I open active directory
    users and computers console and highlight this user and go to properties and select security and click advanced).  some users do not have ""allow inheritable permissions from the parent to propagate to this object and all child objects. " checked.
    Is there a way to script to find out which users do not have "allow inheritable permissions from the parent to propagate to this object and all child objects. .." checked?
    Thank you for your help.

    There are several ways to use ADO in a VBScript program. The alternative below uses an ADO command object, so we can specify a "Page Size". This overcomes the 1000 (or 1500) limit on records returned, as it turns on paging. I have also modified
    the script for comma delimited output. This script should be run at a command prompt so the output can be redirected to a text file. For example:
    cscript //nologo FindUsers.vbs > report.csv
    The modified script follows:
    Option Explicit
    Dim adoCommand, adoConnection, strBase, strFilter, strAttributes
    Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strNTName, strDN
    Dim objUser, objSecurityDescriptor, intNTSecDescCntrl, strInheritable
    Const SE_DACL_PROTECTED = &H1000
    ' Setup ADO objects.
    Set adoCommand = CreateObject("ADODB.Command")
    Set adoConnection = CreateObject("ADODB.Connection")
    adoConnection.Provider = "ADsDSOObject"
    adoConnection.Open "Active Directory Provider"
    Set adoCommand.ActiveConnection = adoConnection
    ' Search entire Active Directory domain.
    Set objRootDSE = GetObject("LDAP://RootDSE")
    strDNSDomain = objRootDSE.Get("defaultNamingContext")
    strBase = "<LDAP://" & strDNSDomain & ">"
    ' Filter on user objects.
    strFilter = "(&(objectCategory=person)(objectClass=user))"
    ' Comma delimited list of attribute values to retrieve.
    strAttributes = "distinguishedName,sAMAccountName"
    ' Construct the LDAP syntax query.
    strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
    adoCommand.CommandText = strQuery
    adoCommand.Properties("Page Size") = 500
    adoCommand.Properties("Timeout") = 30
    adoCommand.Properties("Cache Results") = False
    ' Run the query.
    Set adoRecordset = adoCommand.Execute
    ' Enumerate the resulting recordset.
    ' Write a header line.
    Wscript.Echo """NT Name"",""Distinguished Name"",""Allow inheritable permissions"""
    Do Until adoRecordset.EOF
    ' Retrieve values.
    strNTName = adoRecordset.Fields("sAMAccountName").Value
    strDN = adoRecordset.Fields("distinguishedName").Value
    strDN = Replace(strDN, "/", "\/")
    Set objUser = GetObject("LDAP://" & strDN)
    Set objSecurityDescriptor = objUser.Get("ntSecurityDescriptor")
    intNtSecDescCntrl = objSecurityDescriptor.Control
    If (intNtSecDescCntrl And SE_DACL_PROTECTED) <> 0 Then
    strInheritable = "Disabled"
    Else
    strInheritable = "Enabled"
    End If
    Wscript.Echo """" & strNTName & """,""" & strDN & """," & strInheritable
    ' Move to the next record in the recordset.
    adoRecordset.MoveNext
    Loop
    ' Clean up.
    adoRecordset.Close
    adoConnection.Close
    Richard Mueller
    MVP ADSI

  • Script to find all mailboxes a user can access

    I am looking for a script to find all mailboxes to which one user has access to. I have used:
    get-mailbox -resultsize unlimited | get-folderpermission -user username > file.csv
    The problem with this is the amount of mailboxes, powershell returns:
    Sending data to a remote command failed with the following error message: The total data received from the remote clien
    t exceeded allowed maximum. Allowed maximum is 524288000. For more information, see the about_Remote_Troubleshooting
    The problem is the amount of data. Is there a way to do this by database, by servers, skimmed down, etc?
    Thanks

    Hi,
    The following command can list all mailboxes which the specific user Bob has full access permissions, please try it:
    Get-Mailbox -Database "Mailbox Database01" -ResultSize unlimited | Foreach {Get-MailboxPermission -Identity $_.Name -User Bob}
    Regards,
    Winnie Liang
    TechNet Community Support

  • Script with find and ex

    i want to run a utility from the terminal for all the files in a directory. The utility has an input file name and output file name as parameters. The filenames have spaces and the utility is not taking the names. Can someone help me with a script where i can do the following
    find . -name *.opus
    for each of the files found above I need to run this command
    opusdec "name of the file form above find" "name of the file from above find with an extention wav"
    I wrote this script but it is not working
    ListOfFiles=`find .  -name *.opus
    for i in $ListOfFiles
    do  
        optfile="${i}.wav"
        ./opusdec $i outfile
    done
    thanks for your help.

    Looks like you're missing a backtick
         Change ListOfFiles=`find .  -name *.opus to ListOfFiles=`find .  -name *.opus`
    $() is preferred.  Try
         ListOfFiles=$(find .  -name *.opus)

  • How to find name of report if I know name of instance and location of instance in Output File Store

    Hello all,
    can somebody help me to find name of the report if I know name of report instance and also location of instance in Output File Store. It should be done via Query Builder.
    It is ...rpt file as output from Crystal Reports. I tried few commands in Query Builder but usually they finished with timeout error.
    Could you help me and send specific command? Or way how to change timeout of Query Builder?
    Thanks.
    matus

    Hello all,
    We finally found solution.
    We knew that file is located on path .../Output/a_145/009/002/133521/~ce10c.....9332.rtf
    This file has more than 2 GB. We tried to find which report is related and provide necessary actions.
    As I mentioned we still failed due to timeout error - There was an error retrieving data from the server: CMS operation timed out after 9 minutes.
    So we tried to use our testing environment. We started there QueryBuilder and there we successfully tested that we found details about files from FileStore /like Name of the report in Launch Pad, CUID, ...
    SELECT SI_NAME, SI_CUID, SI_FILES FROM CI_INFOOBJECTS WHERE SI_FILES.SI_PATH = 'frs://Input/a_148/020/000/5268/'
    or
    SELECT * FROM CI_INFOOBJECTS WHERE SI_FILES.SI_PATH = 'frs://Input/ a_148/020/000/5268/'
    Best regards,
    matus

  • Find names of all open windows including other applications besides LabView VIs

    Hi All, I have researched this subject, i.e., to find names of all open windows including other applications besides LabView VIs, but found no solution. Could someone suggest a solution to this?  Thanks.

    Hi,
    Certainly! The Windows API Function Utilities (32-bit) for LabVIEW includes set of LabVIEW libraries (llb) with VIs that make calls to the Windows Application Programming Interface (API) for managing and controlling windows (minimize, maximize, move, resize, rename, close, and so on) including task list with names of windows application running. The Readme.doc contains information on running these VIs.
    Attached below is a zipped file with a VI that list the names of all opened windows.
    Tunde
    Message Edited by Tunde A on 04-18-2007 02:28 PM
    Attachments:
    List Windows Application LV8.0.zip ‏55 KB

  • Bridge CS6 Script to Find Multiple Images in Multiple folders.

    Is it possible to have a script to find multiple images within multiple folders that is on a external hard drive?
    For instances I have a external hard drive assuming it's for a library of pictures.
    Inside this hard drive has folders named as below
    1-1000
    1001-2000
    2001-3000
    3001-4000
    If I had a perfect csv file for example that calls out for specific pictures for example 2, 10,1500 and 2000 (remember think big, it may be a larger list than this it could be hundreds or thousands of pictures); is there a script that would allow me to find these images and save a copy of them on to my desktop so that way I don't have to hunt for them in the old fashion way? I can read scripts but writing them is a different story.

    If you want to go with Batch I would recommend creating an Action of more or less these steps:
    • set the resolution to the same as the background image’s
    • change the image from Background Layer to regular Layer if necessary
    • convert it to a Smart Object
    • add a Drop Shadow Layer Style to the image (do not use Global Angle)
    • place the background image (File > Place …)
    • move it behind the image layer
    • Image > Reveal All
    • make Selection from that layer’s transparency (cmd-click its icon in the Layers Panel) and use Image > Crop
    • select and transform the image layer to fit the intended position
    This would naturally work out best if the images had the same size and proportions.
    For the reflection on the floor duplicate the image, flip it vertically, move it in position and reduce its opacity to maybe 10%.
    Realistically you may have to hide it partially behind the pillows, a Vector Mask would be an option.

Maybe you are looking for

  • Lync 2013 (part of Office 365 Click to run package) Crashes at startup.

    Faulting application name: lync.exe, version: 15.0.4675.1000, time stamp: 0x54629b81 Faulting module name: KERNELBASE.dll, version: 6.1.7601.22616, time stamp: 0x5315adc5 Exception code: 0xe06d7363 Fault offset: 0x0000c44d Faulting process id: 0x1848

  • Error Message When Editing Photo Library

    When I am cleaning up my iphoto library, such as rotating or deleting files, I get the following message every time that I edit or delete a photo or range of photos: "An error occurred while trying to save your photo library. Some recent changes may

  • Help setting up sounds effect page for ipad

    Hello, For the past few years I've maintained a fun webpage (made in DW) that plays sounds on click.  I use it to accent certain moments in my class and sometimes I run several sounds at once to create a mood during stories.  This year our students a

  • Oracle Lite on Cell phones??

    Hi, I have a question, the documentation and metalink said that Oracle Lite is only supported for Laptops, tablet PC, Pocket PC and Palms. However, many people is interested in using on cell phones. Someone knows if certain devices like Black Berry h

  • How to get in 11i?

    Hi all, I have some oracle Form and pl/sql experience. Now I want to get in oracle 11i development field using my oracle Form experience, I have been taking on line 11i functional module on-line training through www.ilearning.oracle.com web site, but