If the name of the document contains, but NOT this

I am trying to write the following script:

If the name of the document contains 'before' and 'square', has.

If the name of the document contains "recto" and NOT "square", do B.

If the name of the document contains "back" and "square, do C.

If the name of the document contains 'back' and 'square', NOT do D.

Here is the code with the conditionals in the same order:

for (i = 0; i < documents.length; i++){
    var curDoc = app.activeDocument = app.documents[i];
    var workingName = curDoc.name;
    if(workingName.match(/^*(front)*$/) != null && workingName.match(/^*(square)*$/) != null) {...} 
    if(workingName.match(/^*(front)*$/) != null && workingName.match(/^*(square)*$/) == null) {...} 
    if(workingName.match(/^*(back)*$/) != null && workingName.match(/^*(square)*$/) != null) {...} 
    if(workingName.match(/^*(back)*$/) != null && workingName.match(/^*(square)*$/) == null) {...} 
}

However, these ARE not return true and false as expected. As far as I know, taken individually, each regex match ground works.  I suspect that the problem lies in the & &, == null, and! = null shares, but am a bit of a loss.

Specifically, a file named "before. TIF"is evaluated as TRUE for this condition:

if(workingName.match(/^*(front)*$/) != null && workingName.match(/^*(square)*$/) != null) 

If(workingName.match(/^*(front)*$/)! = null & & workingName.match(/^*(square)*$/)! = null) {...}

It makes no sense, it does NOT contain the word "square" for the second half of this condition and thus the entire thing, must be set to false. Instead it's the treatment the & & (and) one | (or).

Is (regexMatch! = null & & otherRegexMatch! = null) wrong approach?

I tried with this and the tiff was not serious:

#target photoshop
for (i = 0; i < documents.length; i++){
    var curDoc = app.activeDocument = app.documents[i];
    var workingName = curDoc.name;  

    if(workingName.match(/(front)/g) && workingName.match(/(square)/g)) {alert(workingName +'   ' +1 +'   '+ workingName.match(/(front)/g) + '   '+workingName.match(/(square)/g) )}
    if(workingName.match(/(front)/g) && !workingName.match(/(square)/g)) {alert(workingName +'   ' +2 +'   '+ workingName.match(/(front)/g) + '   '+workingName.match(/(square)/g) )}
    if(workingName.match(/(back)/g) && workingName.match(/(square)/g)) {alert(workingName +'   ' +3)}
    if(workingName.match(/(back)/g) && !workingName.match(/(square)/g)) {alert(workingName +'   ' +4)}
    }

Tags: Photoshop

Similar Questions

  • I can not express outlook to work on this laptop. Emails from test provider sent e-mail that came on the old laptop, but not this one. Error code indicates that there is an error with the password.

    I can not express outlook to receive or send emails usning my other e-mail account.  Their support had me through each entry several times but I still have an error code indicating that my password is incorrect.  The provider to reset the password and I did the change in outlook and it says that the password is incorrect.  They suggested that there may be a software problem in my outlook express.  Your thoughts?

    Completely remove the account. Restart, and then add it again. Who help me? If this isn't the case, you can get enough to try a new identity?
     
    You may have a damaged identity especially if it's the default main identity. File | Identities | Add the new identity. Create a new one and try it. If all goes well, you can import your messages and address book from the old identity and delete it.
     
    Note: Do not use the main word in the name of the new identity.
  • Adobe Muse (CC 2015.1) active not too big but still get error "The Document contains a link to an asset being non-existent".

    I receive the error "the Document contains a link to an asset being non-existent" despite the fact that the property in question has not been expanded beyond the original size. When I point to the item on the list of assets he confirms this, but he said also 'Page size point' and its dimensions are larger than the assets. I do not know what size "page" refers to, or if it has to do with the error.

    Asset.jpg

    as the error, your image to distort seen through some screens and generally making most of the images looks like *... open in photoshop (or whatever the editor floots your boat) and resize the image to have more dpi | pixels then save this image as your new.

  • I want to get only year sysdate with my name of the defined column. but not able to get it.

    I want to get only year sysdate with my name of the defined column. but not able to get it.

    SQL > select to_char (sysdate, 'yyyy') as 'mahesh tyagi' from dual;

    Mahé

    ----

    2015

    SQL > select to_char (sysdate, 'yy') as 'Manu' from dual;

    my

    --

    15

    So I couldn't do 'Manu' or "mahesh tyagi" as the column name.

    The column name is "mahesh tyagi" is simply displayed it shortened to sqlplus due to the known values in the column length.

    create table year_test select to_char (sysdate, 'yyyy') "mahesh tyagi" double;

    year_test / / DESC

    You can change the way sqlplus displays the header of column with something like

    column "mahesh tyagi" format a15

  • Is there a method to extract the document contained watermarks?

    Is there a method to extract the document contained watermarks?

    Can I do this?

    Leonard, it's true that there are opportunities to do using the custom function. I mean the functino of ExtractWatermark() must be written by ourself and that no function is in the SDK.

    Kind regards

    Joe

  • How can I activate on labels in the block diagram, but not on the front panel?

    This question may have been asked before, but searching the Forum did not.

    In LabVIEW 2010, I have 16 indicators of chain on the front panel. I can't have the label for each Visible on the front panel, so I turned it off. But in the block diagram, I need distinguqish one of the other, so I need to make the label (name) visible.

    In the block diagram, if I select indicators Sting all together and go to properties and make the label visible, it makes visible labels on the front but not visible in the block diagram. What good is that?

    How the help of labels (name) of the indicators String visible in the block diagram, but not visible on the front?

    dbaechtel wrote:

    This question may have been asked before, but searching the Forum did not.

    Don't remember already asked this question and get help in this thread?

    Have you tried the things I said in that thread?  How did they not work?

    Right-click on the terminal of BD and make visible > labels.

    It probably will be the FP control show its label as well.  Then go to the FP control, right-click and go to Visible > labels and uncheck the box.

    The terminal of the comics will have a label, and control of the FP will not.

  • The text is visible on the computer screen, but NOT print

    The text is visible on the computer screen, but NOT print

    When I print the document (the header and the footer together can print).

    My printer is Lexmark X 5470.

    Please tell me how to solve this problem.

    Thank you

    Longpo

    Hi Longpo,

    1. what happens when you try to print?

    2. you receive an error message/code?

    Printing problems can be caused by cables that are not properly connected, corrupt, drivers, incompatible drivers, the printer settings, missing updates and problems with your printer. Refer to the help article and check if that helps.

    Solve printer problems

    http://Windows.Microsoft.com/en-in/Windows/printer-problems-in-Windows-help#fix-printer-problems=Windows-Vista&V1H=win8tab1&V2H=win7tab1&V3H=winvistatab1&v4h=winxptab1

     

    Solve printer problems

    http://Windows.Microsoft.com/en-in/Windows-Vista/troubleshoot-printer-problems

    Let us know the status of the issue. If you need help, please after return. We will be happy to help you.

  • Wireless devices can see the wireless network but not connect

    Can someone please help?  I have a WRT54GS v2.  My wired computer accesses the Net fine, and I can see MAC address, IP address, DNS, subnet mask, default gateway in the navigation of the linksys software. The devices can see the network with strong bars but can't connect.

    Help!

    Thank you

    Yes, I tried all of these suggestions before posting and thank you for the reply.  I even called Comcast, my cable provider, in despair attempt to resolve.  Of course, they were no help, but it didn't end up being a problem, with what they should have helped me.

    By simple trial and error for several hours, I discovered that the domain name required to be filled in the first Panel of the router Linksys software.  The domain name resulted in the status panel but needed to be included in the initial group.  The forums I read had informed that some cable companies require the name of the computer and the domain name is filled and others not.  Obviously, if Comcast domain name must be filled out, but not the name of the computer.

  • Cannot open my encrypted Documents? -Cannot open the document: user does not have access privileges

    I am using Window7 and I got some of my encrypted files by opening the properties of the file and selecting the encryption option. I have not had any problems so far, but all of a sudden I can't open my encrypted files. There is an error message indicating "cannot open the document: user does not have access privileges. But I have no other user account on my computer and I am logged in with my administrator profile. I turned off my computer, rebooted and tried various methods, but when I open the file it shows the same message as above. Help, please?

    Hello

    Please follow the steps from the link below.

    Appropriating a file or a folder

    http://TechNet.Microsoft.com/en-us/library/cc753659.aspx

    Also check out the links below.

    Encrypt or decrypt a file or folder

    http://Windows.Microsoft.com/en-us/Windows7/encrypt-or-decrypt-a-folder-or-file

    Recover encrypted files or folders

    http://Windows.Microsoft.com/en-us/Windows7/recover-encrypted-files-or-folders

    Import or export certificates and private keys

    http://Windows.Microsoft.com/en-us/Windows7/import-or-export-certificates-and-private-keys

  • I can connect to the local network, but not to the internet

    Why in an internet connection, I can connect to the Local network, but not to the Internet.
    I have valid IP address and configuration is good.

    I recommend you read some threads here in the forum about similar issues.
    If this problem occurs using the WiFi network, then check if you can use the connection to the local network.
    Using the WiFi network, you must check if the common WLan parameters are favourable;
    Check if the encryption key is right; turn off filtering by mac address, check the TCP/IP protocol settings if it has been set to automatic, disable the firewall settings, rest you WLan router, check if you connected to the right SSID.

    Good bye

  • I sent 2 SMS to the iPhone even from the same location 1 hour out. Why I was charged for the second message, but not the first?

    I sent 2 SMS on the phone even in the same place 1 hour apart. I was charged for the second message, but not the first. Why charge me? I was under the impression that the messages sent between iPhones are free?

    I was under the impression that the messages sent between iPhones are free?

    It's a little more complicated than that.

    If the message is sent as an iMessage (blue) uses the data that could be part of your cellular data allowance or WiFi depending on what you are connected to. If it is sent as SMS (green) it takes however your carrier charges you for SMS.

    For a message to be sent in an iMessage, both parties need to have a device capable of iMessage (e.g., iPhone, iPad, Mac), iMessages allowed to have (settings > Messages > iMessage > on) and be connected to the data (Wifi or cellular).

  • My iPhone 4 is dead. I loaded an hour then tried the power reset but not joy.

    My iPhone 4 is dead. I loaded an hour then tried the power reset but not joy.

    I'm going to assume that your iPhone 4 no is not in warranty, otherwise you'd be on the Apple Store, right?  I also assume that you are not interested to pay the service battery $ 79 or $ 199 iPhone 4 warranty exchange for a device that is worth less than $100 (U.S. prices)

    So so let's solve the problems.
    When was the last time it works well?

    An iPhone 4 is old enough, and if it has been inactive for a while, then it is possible to lose load under the level at which it is able to charge the battery.  The battery has a logic board little teeny buried in the packaging of the battery that dictates the charging process.  There is really no energy, the battery doesn't have enough juice to be able to tell itself to charge when the charger is connected.

    If the phone has relatively recently been works well, then start troubleshooting in the charging port.  Is your refill clean?  Try to clean with alcohol to 99% and a q tip.  If that doesn't resolve, then you need more information - there are some ammeters really convenient usb little inexpensive that you can plug into a charger, then the unit and he will tell you exactly how much, if any, current load appliance pulls.  An iPhone 4 with normal charging system should draw on 1 ampere.   If yours is pulling 1 amp and shows still do not display, try to connect to iTunes to see if your device is recognized.  If this is the case, then you need solve a display problem, not a problem of load.

    If your closer 0 amp, then you need to open your phone and troubleshoot the battery and dock connector.    A lot of DIY resources out there for you help with this, just a google search away.

    A trip to an independent repair facility will also help you to go down on the problem.  Pick one that stands out for its work with the great review, great warranty and someone who is willing to look at this iPhone 4 with a no solution = no fee policy.

  • How to remove a domain controller that was removed from the Internet works but not demoted

    How to remove a domain controller that has been remove from the Internet works but not demoted

    got two domain controllers and been deleted but not retrograde

    can help pls

    Hello

    Your Windows is better suited for the directory on TechNet Services. You can follow the link to ask your question: http://social.technet.microsoft.com/Forums/en-us/winserverDS/threads

    I hope this helps.

  • CD badly placed: is there anyway to restore games on the computer without the CD, we have the Product Code but not the cd, we have misplaced it?

    There is in any case for the games on the computer without the CD of restoration, we have the Product Code but not the cd, we have misplaced it?

    There is in any case for the games on the computer without the CD of restoration, we have the Product Code but not the cd, we have misplaced it?

    borrow the CD, install the game and put in your code. If you don't know anyone with a CD, you will need to buy the game again. teengeek.freehostingcloud.com

  • Laptop detects the neighbouring network but not my home network?

    My problem is the following...

    My Hp Pavilion dv4 1225dx Vista SP1 computer laptop works very well on our router WRT160, computer laptop Dell Inspiron 8600 XP SP2 from husbands can detect the neighbouring network but not ours. Any suggestions, I searched the forums for answers with no luck.  Thanks in advance!

    Change the channel and SSID or.

Maybe you are looking for