Take the incorrect file name in a script file

Hello

I want to write code to catch only in the name of the file at the end.

I tried to write my script like this:

#target photoshop

var myInputFolder = Folder.selectDialog ('INPUT');

{if(myInputFolder!=null)}

myFiles = myInputFolder.getFiles var (/ \.) (jpg) | PSD | TIF | PNG | (gif) / $i);

for (var fileIndex = 0; fileIndex < myFiles.length; ++ fileIndex)

{

var currentFile = myFiles [fileIndex];

If (CurrentFile instanceof file)

{

If (CurrentFile.Hidden) continue;

var doc = app.open (currentFile);

myDoc = doc.name;

value = myDoc.slice (8, -4);

If (value! = 10)

{

Alert ("file naming conversion must be-10");

}

Here, I want to write code more

}

}

}

Here, I want to write that if the value is between 10 and 19 (for example, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) the code should ignore the alert. How to write code.

Thanks in advance,

12345664.JPG

Mohamed S. N

Here is a small script that will get just the file name numbers after the dash and change it to a number:

#target photoshop

var fileName = 'abcde-01.jpg'
var fileNameNoExt = fileName.split('.')[0];
var dashIndex = fileNameNoExt.split('-');
var imageNum = Number(fileNameNoExt.split('-')[dashIndex.length-1])
alert(imageNum)

Tags: Photoshop

Similar Questions

  • Google indexes the incorrect file type: html vs php

    Hello

    This weekend I was helped a lot with a problem, I got on php: http://forums.adobe.com/thread/420710?tstart=0

    However, I had downloaded the site a week before and now Google index the old pages with extension html (http://mysafety.be)

    I have included "not to archive ' and 'no index' metatags, but the amount indexed with html continues to climb and no pages with php extension are being indexed.

    This means that I have to keep alive all the html page with no - archive metatag and redirection to the version of php.

    Suggestions, please?

    Thank you

    Erik

    You can place a file named ".htaccess" in the root of any folder, and the server will use the directives in the file to control how it serves pages for the client.  There is a full set of controls, more can be found by Googling "htaccess", probably you do not want to read, but among them is the possibility to do a server for any extraction of page redirection, allowing you to automatically redirect all requests for *.html to *.php.  Which is nice, is that you can send a header with the redirect than direts search engines to adjust their indexes, called a "301" header.  It specifies that the requested page has moved permanently to the new name of the page.

    On several of my sites, I have this redirect used - the .htaccess file contains the markup like this.

    RedirectEngine on

    Redirect 301 xyzzy.html http://www.example.com/xyzzy.php

    Try Google...

  • PDF files download via imap with the incorrect file size and is considered to be "corrupted".

    Hello

    I have a computer that is using thunderbird for imap emails. Any time I try to view a pdf, the open used attachment attachment and is reported as damaged. I downloaded a PDF directly from godaddy (mail host) and I can view the file properly. I also noticed that the file I tested was 105K when shown on the godaddy webmail but it was only 103K when appearing as an attachment under thunderbird. I also forwarded the email to myself since the webmail and when I open the email of forwareded, the size of the file is correct and the pdf file now opens. I would like to be able to open PDF files with thunderbird without having to send them to myself since the webmail. Are there settings I could change so that PDF files will be correct the first time?

    Thank you

    Try this: open Tools/Options/Advanced/general/Config. Editor, double-click on the mail.server.default.fetch_by_chunks preference to change its value from true to false, close the Config. Editor, OK, restart TB and see if you still have problems to open the attachments.

  • the "incorrect" file structure

    Hi all

    I am trying to add additional columns to my output data file, which captured initially given 3 - axis load cell. I would like to add data the local coordinates of the two stepper motors that carry the load cell. The idea is to capture the profile of movement as well as the acquisition of the force.

    There are two problems that I met, is one major and one minor. I'd appreciate it really is can someone give an idea of how address them.

    (1) the output file's strange structure, cell data are entered correctly, but coordinated captured engine in a strange way, there are some gaps between the record. I am attaching the file *.txt for example what happens. I feel that it is something to do with the frequency of acquisition vs. loop timing, but I'm not 100% sure.

    (2) it is rather aesthetic problem. Ideally, I would like to have control over when to start "depreciation" in a txt file. I thought that if I put a case structure within the main loop and tie a switch, I can achieve my goal. Apparently, it did not work as I want. When I start my program, it creates a .txt file, regardless if the switch is on or off, and then when I turn on the switch, it overwrites the previous file and creates a backup of the old file. Is it really possible to do in Labview? My officemate told what I want "breaks continuous data flow concept in Labview", so I'm a bit puzzled.

    Thanks in advance

    I don't know what you mean by the phrase "damping data in a text file.  I'll assume you mean that the data in the text file logging.

    The reason why the switch is not working for you, is that you have an entry on the measure function go in the right and wrong of the case that the switch is connected to.

    The reason data gets overwritten and saved/renamed files because it is the way in which the parameters are in the express VI properties in the true and the false case.

    The reason why you get a large group of coordinated data of load cell with a single set of stepper motor is the amount of data that you collect at each iteration of the loop.  In each loop, you collect a single piece of data from the serial port with a parameter for each engine.  But as DAQmx, collect samples you of N N-channel where samples of N are all the data in the buffer.  If you are left with N lines of data points for one pair of data points in the serial port.  Try N channels 1 sample instead.

    What you want are rather simple patches, and I do not think that your desktop companion has a clue what he's talking about in what concerns data streams. Dataflow seems to be fine in your VI.

  • Delete the incorrect files (maybe)

    Hello. I have a problem with my WHOLE system. Justa end 5 minutes ago, I deleted a file that has led me to get a weird window saying I need to buy xpwidnows protection that only allowed me to go to all websites or throw most of my programs, saying they are a threat. It seems that it was only 1 .exe file I deleted from a directory deeper into my drive C. I have unfortunately also removed another 2 files or 3 after which programm evry single or. file exe or document asks me to choose a program to open it with. most of the .exe files is easy to open I just bring to the necessary file for which are applications I don't know how to open the installation files. It also appears that I can't click the box when I choose the program to link them together so the next time, it would not be me to find a program. Need your help

    You have a virus/malware infection.  Run these scans on your machine:

    http://www.Malwarebytes.org/
    http://SUPERAntiSpyware.com/

    John

  • Thr bad programs are set to open the incorrect files

    I have major problems, and I tried to solve this problem for a while. Currently, Adobe Reader is ready to just open the start menu and Skype, OpenOffice, Quick Time Player, and AVG 2011 on my desktop. All my OpenOffice Writer documents open with Notepad and it's driving me crazy. Open Office does not open and I need!

    I tried to change the program by 'open with' and "choose program by default", but none of the default ones are the right ones. Help!

    It happened for a few days and I tried to restore the files.

    Looks like your file associations have got blurred.

    If this has not been a problem for too long, the best way to clean things up is to do a system restore to a time before you had this problem:

    "How to restore Windows XP to a previous state"
      <>http://support.Microsoft.com/kb/306084 >

    Otherwise, it's fixed for certain types of files available here:

    'Windows XP file Association problems'
      <>http://www.dougknox.com/XP/file_assoc.htm >

    Finally, you can manually reconfigure your file associations on a basis of extension-by-extension:

    "How to change or choose the program that starts when you double-click a file in Windows XP"
      <>http://support.Microsoft.com/kb/307859 >

    HTH,
    JW

  • Vista, Win sxs file exploded at 50 GB on a laptop of 80 GB available. How I can't take the sxs file in a reasonable size?

    The file sxs on my mother Vista machine is giant and unnecessarily huge (50 GB).  I know 'cleansing' will reduce, but I've read about many users reported a small reduction in size.  Obviously, this thing doesn't have to be anywhere near 50 GB in size, especially when the HD is only 80 GB total.

    What is the real way to kill this file down to the 8-15 GB, that it should be?  Please do not respond with simple "cleaning" - there must be a way to really shoot this thing.

    Thank you!

    There is nothing that works. If he got that big, something has gone wrong. You may have to reinstall Windows.

    If you have not seen these already, check the following:

    http://support.Microsoft.com/?kbid=2592038

    http://blogs.technet.com/b/joscon/archive/2010/08/06/should-you-delete-files-in-the-WinSxS-directory-and-what-s-the-deal-with-VSS.aspx

    The comments which might give you some ideas

    The system update tool can correct certain errors.

    http://support.Microsoft.com/kb/947821

  • How can I solve this problem?  Cannot open in Adobe scan because the incorrect file format or corruption

    When I scan a document and try to bring it on my screen in Adobe, I get the error message that it cannot be opened in Adobe because it's in the wrong format or the file is corrupted. How can I fix this problem?

    What format you scan your documents? Adobe Reader opens as pdf files. If you scan to a different image file formats, reader will give you this message.

  • I have 8 items. I bought a Nikon D750 and take the Raw files. I downloaded Raw 8.8 file converter, but cannot open Raw files

    I have 8 items. For my previous Nikon D300s RAW converter worked well. Now I D750 cannot open Raw files. I downloaded lastest 8.8 Adobe Raw Converter

    Always cannot open Raw file. Get the message "Could not open as it is the wrong type" how to get the last Raw Converter to work with Elements 8? Any info gratefully received.

    You would have to buy PSE13 to do the same thing. PSE8 cannot be updated.

  • Not on the incorrect user name or password error message no match.

    Can start with no problem but on my desk is an error box indicating... username and password do not match... you used...
    Have found nothing so far is not working do not, but it's annoying to see this, whenever I connect...
    I would like to attach the screenshot of the message, but does not know how to do...

    A way to find which program or a web page, it is in reference to?
    Thanks for any help!

    Unless the screen shot shows a window with a title that generated this msg her won't help.

    You use the cutting tool to create screenshots

    The clean boot procedure helps determine the cause of the issue

  • Server data store will automatically get updated when the new file (with the same name) is placed in the landing area


    Hi guys,.

    The data store server-side will get automatically updated when a new file with the same name is loaded in the landing area?

    for example

    1 data store created for server-side get the file named UK.xls (he has 5 rows)

    2 snapshot created for the above data store

    3. created with the snapshot process

    After that if I remove 2 lines from the same file and load again to the landing (with the same name). So by re-running the process will take the last file OR do I need to reload the file in the data store every time when there is a change in the file. We also tried with option to work but the last file was not picking up.

    Any help will be really appreciated.

    Please lets us know your updates.

    Please advice

    Thank you

    VT

    Hello

    When you create a snapshot, you create a snapshot whose task (provided that you use a data store server-side) can be run from a job. To refresh the data, run the snapshot in a job task. If you create a task at the time the snapshot and the processes that use it, they will automatically connect and will be 'upstream' data through the snapshot in the process. You can then choose whether it would be appropriate to write the snapshot or not (for the effectiveness of performance if you want to do the straight through processing) by activating or deactivating the bucket of data staged that the snapshot written to. The snapshot in the work task means that the data is refreshed.

    For the work of design to the Director, you can refresh the snapshot by running again it manually in the context menu.

    Kind regards

    Mike

  • Cannot change the Zoneinfo file

    I had problems with El Capitan and decided to run a permissions repair script to see if it solved the problem. It came with two executable files that can not be changed. I looked on my first mac and the same files were not executable. I have a great difficulty to try to correct the incorrect files or copy the right files the first mac to it. I tried Sudo Rm, Chmod, Chown root. All attempts have been thwarted. What else can I do other that Reinstall from scratch?

    It's probably the new security SIP in El Capitan, which prevents make you these changes. You are right however that these files do not have x (execute) permission turned on.

    You could wait 10.11.4 and see if she arranges otherwise you could temporarily cut off SIP to enable to fix now, or as you say erase and reinstall.

  • card error generated Muse site - incorrect domain name

    the sitemap generated muse for my site pcprv.org is to generate code with the incorrect domain name

    prcrv.org instead of the correct pcprv.org

    <? XML version = "1.0" encoding = "UTF-8"? >

    " < urlset xmlns =" http://www.sitemaps.org/schemas/sitemap/0.9 "xmlns:xhtml =" " http://www.w3.org/1999/xhtml ">

    < url >

    < loc >http://prcrv.org/assets/pcprv-2010adbasic.pdf< / loc >

    < lastmod > 2010 - 04 - 14 < / lastmod >

    < changefreq > weekly < / changefreq >

    < priority > 0,5 < / priority >

    < / url >

    I can't find where this happens - site works fine

    You specify the domain name in the file > export as HTML... or file > load to the host FTP... of the dialog boxes. If you publish your sitemap.xml generated by Business Catalyst and selects the areas assigned in the Admin of BC (accessed via the button manage in Muse).

  • Need help to read the xml file and place it in a table.

    Nice day!

    Here is the configuration. I have a xml file from another source which will call a stored procedure in my database (which I am supposed to create). This is a first for me, I've never done development pl/sql or worked with xml. :(

    That's what I hoped to accomplish, if there is a better way, that I am open to him.
    In short, to have a stored procedure that takes the xml file (transmitted by third parties via the call, no url must be a file), creates a temporary table and populates the two columns needed. Then, the SP will make a select join with the temporary table and other data available in another schema. Once the completed table selection will be truncated and dropped. SP farm.

    Details:
    DB: Oracle 11.2.0.1 RAC.
    Charset: AL32UTF8
    Example of XML: (nearly 10,000 lines like this in production)
    "< MerchantID report =" "#" name = 'Conversion detail report' ReportStartDate = '2011-09-27 12:00:00GMT' ReportEndDate = '2011-09-27 21:38:13GMT"Version ="1.1"> < Conversion = '1234567891234567 D' MerchantReferenceNumber Convertingdate =" 2011-09-27 13:39:02 "RequestID ="1234567891234567891234"> < OriginalDecision > REVIEW < / OriginalDecision > < NewDecision > ACCEPT < / NewDecision > < Reviewer > testusr < / examiner > < ReviewerComments > no reason to reject. < / ReviewerComments > < Notes > < Note Date = "2011-09-27 13:39:02" AddedBy = "testusr" comment = "Took possession" / > < / Notes > < queue > Digital Review < / queue > < profile > Digital orders QA < / profile > < / Conversion > "
    ...
    < / report >

    What I tried.
    I found a tutorial: http://it.toolbox.com/blogs/oracle-guide/oracle-and-xml-in-action-a-real-world-example-5319 I tried and was able to make it work. But I could not duplicate the results with my xml file. So I looked away and have had no success. :( I'm not a developer, so I'm really bad...

    I found a note of support: (how to load an XML file into a Database Table using DBMS_XMLSave unaided Bfile [227476.1 ID]) and couldn't make it work.

    I found some online then Odie son xml and tried these but slipped and couldn't get my versions of these great answers to work for me.

    Then... I'm here now and hoping that someone could walk me through this.


    I tinkered this SP (it doesn't have to be that way, the suggestions are greatly appreciated)

    create or replace procedure xml_to_table (call_1 call_2) as

    Start
    run immediately "CREATE GLOBAL TEMPORARY TABLE XMLType IMRPT
    --(clé primaire contrainte-imrpt_pk (MerchantReferenceNumber))
    XmlType store as xml binary basicfile
    -(high compression)
    virtual columns
    (MerchantReferenceNumber as (xmlcast (xmlquery ('/ Conversion/MerchantReferenceNumber ' from object_value content back) as VARCHAR2 (32))))
    , NewDecision as (xmlcast (xmlquery ('/ Conversion/NewDecision ' from object_value content back) as VARCHAR2 (10)))
    )
    -ON COMMIT PRESERVE ROWS

    run immediately 'save xml as a file on the local system?'

    insert into IMRPT (MerchantReferenceNumber, NewDecision)

    run immediately "join select statement.
    run immediately 'truncate table IMRPT.
    run immediately "drop table IMRTP.

    end;
    /

    On my last test, I tried to select just in the xml file using this:

    DECLARE
    indomdoc DBMS_XMLDOM. DOMDocument;
    innode DBMS_XMLDOM. DOMNode;
    myParser DBMS_XMLPARSER.parser;
    buf VARCHAR2 (2000);
    BEGIN
    myParser: = DBMS_XMLPARSER.newParser;

    DBMS_XMLPARSER.setBaseDir (myparser, 'XML_DIR');
    DBMS_XMLPARSER. Parse (myParser, "test.xml");

    indomdoc: = DBMS_XMLPARSER.getDocument (myParser);

    -just to test content
    innode: = DBMS_XMLDOM.makeNode (indomdoc);
    DBMS_XMLDOM.writeToBuffer (innode, buf);
    Dbms_output.put_line (BUF);

    dbms_xmldom.freeDocument (indomdoc);
    dbms_xmlparser.freeParser (myParser);
    END;
    /

    It was another accident and burn.

    Any help would be appreciated.

    Thank you

    Like I said:

    Here is an example using a REF CURSOR variable ( you will need to declare a plus for your actual procedure )

    Your procedure has two parameters, you must declare two variables to hold the two REF CURSOR ;)

    DECLARE
    
      v_filename      VARCHAR2(50) := 'DMReport.xml';
      v_rc1            SYS_REFCURSOR;
      v_rc2            SYS_REFCURSOR;
    
      v_order_name       VARCHAR2(100);
      v_reason_text      VARCHAR2(100);
    
    BEGIN
    
      xml2table(v_filename, v_rc1, v_rc2);
    
      commit;
    
      loop
        fetch v_rc1 into v_order_name;
        exit when v_rc1%notfound;
        dbms_output.put_line('ORDER_NAME='||v_order_name);
      end loop;
    
      close v_rc1;
    
      loop
        fetch v_rc2 into v_order_name, v_reason_text;
        exit when v_rc2%notfound;
        dbms_output.put_line('ORDER_NAME='||v_order_name||', REASON_TEXT='||v_reason_text);
      end loop;
    
      close v_rc2;
    
    END;
    /
    

    If you test this in SQL * Plus, do not forget to SET SERVEROUTPUT ON to see the result.

  • Helps the event.target.name

    I'm very green with actionscript and coding in general so please forgive me if I ask you something that sounds super easy.

    Is it possible to take the "event.target.name" value, which in my case would be something like 'SW5005_mc' and change this value.

    I use this value now to tell another clip of gotoAndStop (event.target.name); I have identical to the event.target.name marked images.

    I would like to take the value of event.target.name for example "SW5005_mc" and delete the "_mc" and put a dash between the 'SW' and the '5005.

    for "SW-5005" and then I'd spend it in a text field.

    I don't really know where to start, or if this is possible.

    Thanks for any help or suggestion,

    Chris

    You can use String.indexOf to find the _ and just get everything entered, then use substr and substring for the rest:

    var a: String = event.target.name;
    var b:String = a.substring (0, a.indexOf ("_")); get the front part of the _
    var c:String = b.substr (0.2) + "-" + b.substr (2); Insert a - between the first two characters and the rest
    trace (c);

    SW-5005

Maybe you are looking for