conditional script by a specific part in the docname

I did something to have that kind of stenosis on photo I'm working:

0000000000001_v1_fg1208015_det.jpg

I would like to know if I can do a part of the name, for example one secured a part named script v1 is (view 1).

but I had also, at the same place in the structure v2 or v3, etc...

My idea is to make a script of what a State part of the name of the document.

Thx for help

If you want to make this one document at a time (or automate > batch on an entire folder later) use this:

var workingName = app.activeDocument.name;
if(workingName.match(/(v1)/ig)){
    //do something
    } else if (workingName.match(/(v2)/ig)){
    //do something
    } else if (workingName.match(/(v3)/ig)){
    //do something
}

If you want to loop through all open documents, use this:

for (i = 0; i < documents.length; i++){
    var curDoc = app.activeDocument = app.documents[i];
    var workingName = curDoc.name;
    if(workingName.match(/(v1)/ig)){
        //do something
        } else if (workingName.match(/(v2)/ig)){
        //do something
        } else if (workingName.match(/(v3)/ig)){
        //do something
        }
    }

NOTE: the 'i' at the end of each pattern of regex converts this case... If you want it to be case sensitive to get rid of the 'i '. In addition, in the second option if the part 'do something' includes the closure of the document, that rise out of the loop. In this case change the iteration backwards like this:

for (i = app.documents.length - 1; i >= 0; i--)

Tags: Photoshop

Similar Questions

  • How to search for a specific part of the name of cookie (w / jokers?) in the cookie exception list?

    Hi all

    in the list of exceptions of cookies (Preferences-> privacy) I would need a search to a specific part of the name of cookie, which is < www.*.org & gt; < * research * of *. * > etc...
    A perfect solution would deliver the use of wildcard characters. Too much!

    Such a solution is currently available?
    Maybe like add-on?
    Are there any ideas/plans established for future versions or?

    Thank you in advance, I appreciate your advice.

    Best regards
    Klaus

    Maybe:

  • Cropping to a specific part of the Clip

    In this clip to key, how can I get specific parts? Left to the right to cancel the corner of the sofa. Top to bottom to cancel grandmother until she falls.

    Is it possible to crop from the corner to the Middle, or a specific section?

    Thank you.

    I use FCP X 10.2.3.

    TTry using masking to draw.

  • How to make a specific part of the video blurry

    Hello

    What is the easiest and most flexible way to make a specific part of a blurred video? It should be possible to create animations of movement with it because the party that should be blurred in the video also changes.

    I read an article about it on help.adobe but I can not find! A common way to do are probably just copy the movie, but I don't like this method.

    Best regards

    Apply a blur with a mask effect and use tracking.

  • I need to replace a color on my image with a specific part of the image color.  How do I?

    I spent over 2 hours trying to figure out how to replace a color on a part of my image with a specific color indicated on another part of the image.  So far, I was able to go to "Replace color" on my version of Adobe Photoshop, but it seems that I can only change the hue and brightness of the color that it is currently.  I need to use a specific color, so this didn't help me.  Does anyone know how to complete the task that I refer to?

    In addition, please keep in mind that I use Adobe Photoshop 6.0, not a fancy cs version or whatever it is.  So it's fairly old school...

    Any help/comments are greatly appreciated!  Thank you.

    Hello

    In fact, you can choose a specific color using the replace color function!

    Go to Image > adjustments >, replace color

    Select the color you want to replace. Then, click on the 'Result' box in the section of replacement (see below)

    A color picker dialog box opens, where you can use the eyedropper tool to select a specific color in your image, or you can enter the specific RGB/CMYK values.

    Please post again if you have any other questions - I use CS6, but as far as I know, this process works the same for PS 6.0.

    Good luck!

  • Script to export specific elements of the VM inventory, by folder

    Hi all

    I was trawl through the discussions here... and I think this has already been done before, but maybe not in the same script... and I'm not much more than a writer.

    I'm looking to export to CSV, the following information for each virtual computer, but sorted by folder:

    Folder name, VM name, no. vCPUs, memory, HDD (GB) SCSI ID/Virtual Device Node, the size of the disk in GB (size provisioned)

    that is something that would be output similar to (assuming that 'Customer ABC' is the name of the folder):

    ABC's of customer, Server1, 4, 16, SCSI (0,0) 1, 60GB, a SCSI hard drive hard drive (0.1) 2, 20GB

    Customer ABC, Server2, 2, 8, SCSI (0,0) 1, 60GB, a SCSI hard drive hard drive (0.1) 2, a SCSI hard drive, 20GB (0.2) 3 250 GB

    Who is?  I don't know that lucd has something up his sleeve for this. Not too worried if the description of the hard drive is not exactly the above (to be honest, just the SCSI ID or "Hard disk 1' etc, it would be perfect). As each VM is likely to have a different number of hard drives, and I want that all information for each VM on the same line... It is probably best to put the info hard drive at the end.

    We have about 200 VMS, and it will grow - so I wonder if something with 'Get-View "?  I read everywhere and it seems that this method is fast enough.  Furthermore, a script where we set the variable of the specific file we want to question rather than in the object of data centre?

    Any help on this is much appreciated - let me know if the above makes no sense.

    Cheers, James

    All credit goes to Lucd and Alan Renouf.

    $Information = @()
    $Vminfo = Get-VM | Select-Object *, @{N="HDDs"; E={$_ | Get-HardDisk}}, @{N="HDDcount"; E={($_ | Get-HardDisk).length}}
    $vmlist = $Vminfo | Sort-Object -Descending HDDcount
    foreach ($vm in $vmlist) {
        #$Harddiskinfo = $vm | get-harddisk
        $props = New-Object PSObject
        $props | Add-member -name "Folder" -Membertype NoteProperty -Value $vm.folder
        $props | Add-member -name "VMName" -Membertype NoteProperty -Value $vm.Name
        $props | Add-member -name "vCPUs" -Membertype NoteProperty -Value $vm.NumCpu
        $props | Add-member -name "Memory(GB)" -Membertype NoteProperty -Value $vm.MemoryGB
        $DiskNum = 0
        foreach ($hdd in $vm.HDDs) {
            $controllerinfo = $hdd.ExtensionData
            $controllerkey = $controllerinfo.controllerkey.tostring()
            $keycount = ($controllerkey |  measure-object -Character | Select-Object -expandproperty Characters).tostring()
            $virtualID = "{0}:{1}:{2}" -f $controllerkey.substring(0,1), $controllerkey.substring($keycount - 1), $hdd.ExtensionData.Unitnumber
            $props | Add-member -name "Disk$($DiskNum)scsiID" -Membertype NoteProperty -Value $virtualID
            $props | Add-member -name "Disk$($DiskNum)Harddisk" -Membertype NoteProperty -Value $hdd.Name
            $props | Add-member -name "Disk$($DiskNum)Size(GB)" -Membertype NoteProperty -Value $hdd.CapacityGB
            $DiskNum++
        }
         $Information += $props
    }
    $Information | Out-GridView
    

    Reference URL

    http://www.virtu-al.NET/2009/11/17/PowerShell-gotcha-Export-CSV-out-GridView-and-others/

  • Need help finding a specific part for the predator

    I am looking for the metal clip that holds the 2280 m2 card into the top slot (for the 22110 m.2).  There must be somewhere, I don't know where.  Its killing me.

    Ok.  I'm not doubting you, but the only thing that I have to go is the official specification.  I don't have your computer model and I don't have an ssd M.2 22110 to see if it would fix it properly.

    In any case...

    Here is the official specification for G9_791 and G9_792 and B21

  • Export-rough on only a specific part of the video

    I exported the video of this project before, to H.264 1080 p 24 frames per second and it worked perfectly fine. I used the same exact settings to export this section small 1 minute, and with the video from the same source as before, still now export is jerky as hell. What could possibly happen?

    You can create a new sequence and drag the images of the old in the new.

    You can also make a new project and import old project in this new.

    See if this will help.

  • Change a specific part of the color of an image to something else

    image of reference for details: http://filesmelt.com/dl/Road_that_needs_work.png

    I'm changing the white in this image of an orange/yellow. How could I get this?

    One way would be to use Select > color set for highlights, then range

    Add a color fill adjustment layer (layer > new fill layer > solid color) and

    set blending mode to multiply.

    You may have to paint on the layer mask with a black brush to remove

    some parasite color outside the line.

    MTSTUNER

  • Help: Configure the simple test sequence, operator selects particular test connects to the part of the teststand sequence file and then performs the test

    Hello

    I am very new to TestStand, please see the question below and give advice.

    I want to set up a simple test sequence.

    I want a message to popup on the screen that asks the operator what unit of 6 units (maximum 10) to test (i.e. There is say box of 6 to 10 s to select from).

    Then the sequence goes to the specific part of the sequence and performs the test on a unit that either has been selected.

    What is the best way to do it?

    I use pop-up message windows to do this? and if so what should I connect to the correct part of the sequence file?

    Pop-up message windows allow only 6 options to select from?

    Thank you

    Hello

    You can do this by using the method of message popup. You can ask the user what unit want to run message by inserting in the expression of the message in the message popup step parameters. Something like below

    "Enter the number of execution unit.

    1 Unit1

    2 unit 2

    .......

    10 Unit 10 "

    then check the 'Enable response text box"tab is different from the stage. When the user enters the unit number you can get the value entered by the user by inserting the below statement post expression of message popup step parameters

    Locals.String = Step.Result.Response

    Note: The string is a local variable to be set.

    Convert string to number and send that output to pass the expression you can use a sequence of call step to call the sequence according to which must be performed. (I hope your each unit will file separate sequence)

    I hope that this solves your problem. If you do not understand please let me know so that I can put a small example and send it to.

    See you soon,.

    Krishna

  • You want to read binary files in some parts of the 500th row in the 5 000th row.

    I have files of 200 MB of 1000561 lines binary data and 32 columns when I read the file and sequentially conspire full memory of the generated message.

    Now, I want to read the file in pieces as the 500th row 5,000th row with all the columns and it draw in the graph.

    I tried to develop logic using functions file advanced set file position and the binary file reading block, but still not get the sollution.

    Please, help me to solve this problem.

    Thanks in advance...

    Hi ospl,.

    To read a specific part of the binary, I suggest to set the file position where you want to read the data and specify how many blocks you must read binary file for reading binary file.VI

    for example, if you write table 2D binary file, and then mention you data type this 2D chart and make your account (5000-500). Then together, you produce position. If you have 32 DBL data type and column then it is 256 to the second row and 256 * 500 for line 501th. Use this number as input into your position.vi file get.

    I hope you find you way through this.

  • How to use the middle part of the audio that I imported instead of having it starts to run and play?

    I tried to start making animations and I want to only use the middle part of the audio, but when I add the audio in the chassis he makes me do the beginning of the part of the audio rather than take a specific part of the audio and put it in, so my question is how can I use only a specific part of the audio without the start of the game?

    You can use actionscript (check the class sound - in particular the method of reading) to start your sound anywhere you want:

    s var:Sound=YourSoundsClass();

    s.Play (specificpartinseconds);

  • CFEXECUTE / ant script return do not result in the CF

    I have a batch script that is running an ant script that is running "cvs log h application.cfm" on the cvs server.

    When I run the script commands manually on the command line, everything works fine.

    When I run the command via CFEXECUTE script, the batch works very well, the ant script works fine, but the cvs command does not seem to do anything. The results of the tag are:
    [echo] front
    [echo] after

    As you will see the (unchanged with the exception of the cvsroot attribute) attached ant script, echoes are and part of the cvs command.
    When running from the command line, I get the results of the cvs log command between these lines, but I get nothing with the CF.

    Any ideas on how to get this to work at all will be greatly appreciated.


    I use 7.01, but I corrected the tag CFEXECUTE by restarting the service CF twice.

    I also managed to finally get the CVS little work - changing : ext: to : ssh: -which I'm sure I've tried before and it wouldn't work, but it works now so I'm very happy.

  • Basic conditional script based on the number of lines in a text layer?

    Just received help here to write a conditional script by using the font size of a text layer. Thank you all for this.

    The next hurdle is a conditional script using the number of lines in a text layer in the differential. Far as I can tell it not the layer details which specify the number of lines. Just '\r' for a return in the idTxt descriptor. Nothing seems to stand for a soft return as far as I can tell. I'll probably have to be able to count the lines with soft and hard returns.

    Any thoughts?

    I was playing around with this a bit and here is a small script to determine the number of rows. This is based on the self in the head, that I calculated to environ.108 times the size of the font.

    #target photoshop
    app.preferences.rulerUnits = Units.POINTS;
    var doc = activeDocument
    var tL = doc.activeLayer
    var h = tL.bounds[3]-tL.bounds[1]
    var per = ((h/5)-(tL.textItem.size))/tL.textItem.size
    var num = h/(tL.textItem.size *1.108)
    
    alert(Math.round( num))
    
  • How can I change / remove the first seconds of the view / specific part of an audio track in Premiere CS6?

    It is very difficult to accomplish.  Is it possible that I can do the biggest wave form?  I want that its not let me cut the specific part.  Its always keeping first frame or two

    Make a zoom in on the timeline with the navigation bar or the scroll wheel and also make her taller audio track by scrolling in the header.

Maybe you are looking for

  • Hello is broken?

    If I call or the other person makes, we both get nothing

  • Smart keyboard. Shortcuts

    That means the lower left button on the keyboard smart do? (It looks like a globe). Apple, for the price of the keyboard, I think you could add some decent directions to your Web site. What are the keyboard shortcuts?

  • project and the strange behavior of FPGA v

    I had a strange problem with my main project and the FPGA inside screws. It seems than a recent revision/replacement of a part of the code (replaced subVIs with the latest revisions with different names) prompted the VI to load screws unused when I s

  • FS2004 will not work on windows 7

    FS2004 will not work on windows 7

  • Display the ListView data not grouped data

    How to read data from an SQLite table and display it on a ListView without the GroupDataModel. I don't want my list to be grouped.