Parsing a file name and printing a portion to an image

Ive got a script writen for me that reads the file name of the image, creates a new layer , prints it ti the bottom of the image. I was wondering if anyone knew if there is a way to parse only a portion of the file name out and print that to the screen. Below is the relevant part f the code (I think) that selects the text to be printed on the new layer
var myLayerRef = docRef.artLayers.add();
        myLayerRef.kind = LayerKind.TEXT;
        myLayerRef.name = "Filename";
        var myTextRef = myLayerRef.textItem;
if the file name of the image is ;  30090416 0056 , I want to use only the 0056 portion, as the code is written above the whole file name save the extension is written to the image.
Thoughts?????

That didnt seem to work, the same full filename (minus the extension) still prints.  Here is more of the script. I tried to attach the whole thing but it wouldnt upload.
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PERCENT;
try
var docRef = activeDocument;
// Create a text layer at the front
var myLayerRef = docRef.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
myLayerRef.name = "Filename";
var myTextRef = myLayerRef.textItem;
//Set your parameters below this line
//If you wish to show the file extension, change the n to y in the line below, if not use n.
var ShowExtension = "n";
// Insert any text to appear before the filename, such as your name and copyright info between the quotes.
//If you do not want extra text, delete between the quotes (but leave the quotes in).
var TextBefore = "";
// Insert any text to appear after the filename between the quotes.
//If you do not want extra text, delete between the quotes (but leave the quotes in).
var TextAfter = "";
// Set font size in Points
myTextRef.size = 24;
//Set font - use GetFontName.js to get exact name
//myTextRef.font = "TimesNewRomanPSMT";
myTextRef.font = "Arial";
//Set text colour in RGB values
var newColor = new SolidColor();
newColor.rgb.red = 255;
newColor.rgb.green = 255;
newColor.rgb.blue = 255;
myTextRef.color = newColor;
// Set the position of the text - percentages from left first, then from top.
myTextRef.position = new Array( 2 , 99);
// Set the Blend Mode of the Text Layer. The name must be in CAPITALS - ie change NORMAL to DIFFERENCE.
myLayerRef.blendMode = BlendMode.NORMAL;
// select opacity in percentage
myLayerRef.opacity = 100;
// The following code strips the extension and writes tha text layer. fname = file name only
di=(docRef.name).indexOf(".");
fname = (docRef.name).substr(0, di);
//use extension if set
if ( ShowExtension == "y" )
I really appreciate the help.

Similar Messages

  • How to print the report file name and path and the last mod date

    Good morning,
    I am trying to print on the footer of the report the report file name and path as well as the report last modification date.
    Anyone would know how I can do that? I have checked the doc but found nothing.
    Thks. Philippe.

    Did you ever determine how to print report name and report last mod date?
    Thanks

  • How to print file name and date on document

    How can we print the file name and date, like in the old days, on a document as a header or footer?

    Not the print dialog for iWork but in the app itself. Here is Pages:
    Regards,
    Colin R.

  • Printing FILE NAME and DATE PRINTED?

    when i was on a mac i used to be able to have a default in the printer dialog so that every page printed showed the file name and the data printed. i would like to do this in the mac but i am guessing that this has to be done in either the specialized software dialog box or perhaps in a mac dialog box?
    in any event, can anyone help me figure out where i might find a place to do this? i haveadobe acrobat but i wold also like to do it in something like Preview as well.
    TIA

    hotwheels 22 wrote:
    if i have documents coming that i print for a project and these are quite naturally coming from different software it i have no way now of being able to FIND this file in my computer when i am looking at it.
    Consider using Find from the File menu or Spotlight to search for the document. In one of your previous posts, you stated that you name documents with a date and name. Then perhaps search for the name. Also, with your method of naming documents, if the document is a letter, wouldn't the date on the letter and the person to whom the letter is addressed to give clues to the filename and thus finding it on your computer?
    this is a major organizational issue over here and customizing a template for all my various software should be unnecessary IMHO.
    I do not know how many documents you deal with but I do know that there a many organizations that deal with billions of documents. In addition, if you share documents with others or others with you, there is not a filenaming method that works for everyone. People adapt to each other. A date in a filename could have several forms such as month-date-year or year-month-date, two digits or four digits for year and so on and so forth.
    Are you saying it IS necessary to have this dual file type that has a Pages document which then prints a PDF?
    No. Please re-read  what I wrote and the Pages Help Center articles.
    also, is there in fact a way to save a PDF back out as a Pages document?
    Yes, re-read what I wrote (that which you quoted).
    "Acrobat has the capability to save a PDF in other formats such as Microsoft Word, which can be opened in Pages. That said IMO, a separate Pages document for each "custom" letter/report would not be necessary."
    alternatively i guess i could create a Pages TEMPLATE - that has a DATE in the header that automatically updates .../but/ i am realizing that this has the unfortunate consequence of having the DATE updated if i open the Pages document again
    But that is what you stated you wanted because
    ...and try to remember to SAVE AS this document with another name with the original FILE NAME but a NEW DATE. this does not always work and sometimes i write over the original accidentally.
    anyway, maybe the answer here is to create a Template for any new document type and simply use this template any time i need to create a PDF and then not save or delete the original Pages document but this seems a bit hairy and dangerous in terms of possibly losing a file if i forget to print to PDF or something.
    You have redundant backups, yes?
    It seems that your understanding of a template is different from what it actually is, its purpose and its use. If you have not already done so, try using one of the included Pages templates to create a document that you would reuse to get a better understanding of how it works and to help determine your workflow. What you wrote in the last post seems to be a lot of what ifs but not hands on experience with the software itself. My response was based on my experience of using many types of software and in particular to your questions, Pages and Acrobat. Perhaps you will find better responses in the Pages forum and for Acrobat there is a forum at the Adobe web site.
    is there a lock file functionality in Pages in Mountain Lion or was this in Lion?!
    Perhaps reviewing the tutorials for Pages or searching with Google would  help answer many of your questions.

  • Printing my PDF with File name and Tags Stamped on

    To Forum,
    Possibly not a completely Apple related query, but if anyone know it would be great.
    id like to print a PDF on my MBP with the File name and Tags applied to it stamped on the paper copy... or come to think of it, stamped on the PDF copy which i then print out with those stamps on. Either way will do. Any ideas? Its not immediately obvious when i look at the Printing Prefs box.

    This is an option built into various apps - Safari, Firefox, Microsoft Office.
    There are "PDF Utils" that do this on PDFs one at a time. Can't find a specific one for Macs, but found 2 for Windows.

  • Can I print the File name and page number

    When printing a file, I would like to print the File Name and the page number also...something like a header, in every page printed.  Is this possible in Acrobat?  Please advise.
    Thanks

    Sure. Did you look under Tools - Pages - Header & Footer ?

  • Specify the output file path and print name when printing pages

    hi,
    how can i Specify the output pdf file path and print name when i am using the function PrintPagesSilent from AcroAVDoc Object.
    My Code :-
    Acrobat.AcroAVDoc doc = new Acrobat.AcroAVDoc();doc.Open(path,
    "temp");

    Dear Irosenth,
    i try with different format (doc, docx,  xls, jpg, bmp and txt) and it working successfully, but it give an random name for the file which saved in default folder for Adobe PDF print.
    you can use the following function:
    private void PrintPDF(string[] inputfilepath){
    foreach (string path in inputfilepath){
    Acrobat.
    AcroAVDoc doc = new Acrobat.AcroAVDoc();doc.Open(path,
    "temp"); 
    Boolean v = doc.PrintPagesSilent(0, ((Acrobat.AcroPDDoc)(doc.GetPDDoc())).GetNumPages() - 1, 0, 0, 1);doc.Close(1);
    and calling it by the following code:
    PrintPDF(System.IO.Directory.GetFiles("c:\\t\\printjob"));
    copy all files that you want to convert in side the mentioned path and run it program, then check the defualt print path for Adobe PDF printer.
    test it and reply me. thanks again

  • How do I get the file name to print up closer to a horizontal photo?

    Kind of a nit-picking question, but here goes anyway:
    I use Lightroom's Print module to create contact sheets (three rows by three columns). I check the "Photo Info" check box and select "Filename" to have the file names printed with each photo. When the photo is shot vertically, the file name prints at the lower edge of the photo, as you would expect. However, when the photo is shot horizontally, the file name still prints down in the same place where it would print if the photo were vertical. That can be confusing because if the next photo down on the sheet is vertical, a file name can end up being much closer to the vertical photo below it--to which it is completely unrelated--than to the horizontal photo above it, to which it actually refers.
    Is there any way to get Lightroom to print file names closer to horizontal photos?

    Thanks to both of you for your speedy responses. Making all the shots horizontal or vertical (i. e., unchecking the "Rotate to Fit" box on the right) is not what I want. Increasing the vertical spacing is a possibility, but that'll make the vertical shots smaller. There's a program called "ImageBuddy" which does exactly what I want LIghtroom to do in this instance: print the filenames of only the horizontal shots higher and therefore closer to the photos to which they refer. It's quite cheap, but I'd rather not use Lightroom for everything else and ImageBuddy just for contact sheets, so if anybody knows of a way to do what I want to do within Lightroom, please do clue me in.

  • How to set file name and destination folder without user interaction

    how can I set the file name and destination folder to generate a pdf file like "c:\myfolder\document.pdf" in this folder automatically.
    Is there a tag in .joboptions ?
    Goal: User click print button. In the background a pdf will be generated in e.g. "C:\myfolder\document.pdf".
    that`s it.
    I know that the query dialog for save as can be turned off. But the file name depends on the application.
    Thanks for your help.
    TK

    Hello,
    Please post this  in  PI forums
    Regards, Anil

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • I can not download any files using Safari ? when I choose to download application file the URL include the file name and stop responding. Any help??

    I can not download any files using Safari ? when I choose to download application file the URL include the file name and stop responding. Any help??

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box.
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem(s)?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. The Guest login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, you can’t boot in safe mode.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

  • Workflow with images,file names and full captions.

    I am working on my mother's memoirs, which will include a block of photo pages.  Those pages will be laid out by a friend.  I would like to use a contct sheet of some kind as a reference to what is to be included with what caption but am discovering just how difficult PE8 Organizer is to work with.
    First I tried the obvious print contact sheet and discoverd that captions are truncated if they run wider than the image itself.
    Secondly I tried a photo book and found that large images do not automatically resize to fit the picture placeholders. Seemed to pick up full caption but I have too many pictures to manually fit.
    Third I tried a web page output but then captions can't be copy and pasted for inclusion into group caption panels!
    Then it occurred to me that even just a list of file names and captions would be sufficient ... but even that is too much for an Adobe catalog to give up!
    All I want is a reference to images and captions, ideally grouped 4 at a time per page as they will be shown in those picture pages.
    Any suggestions would be welcomed.

    I can see two ways to do what you want.
    The first one is to divide you workflow in two steps. Install the free software FastStone image resizer, which can do a batch to resize and put your caption where you want. Batch process the files in a new folder while renaming them with something like 'old name'+ 'resized'. This is to avoid duplicate names. Import them into the organizer. Create an album with all those files, and put them in the correct printing order. Select all and export 'as new files' renaming them with 'common base name', in original format. That should keep the custom order of your project.
    There are also batch renaming and resizing with the affordable Elements+ add-on, but I suppose the first solution will be easier.

  • Pdf portfolio source file name and date in file details

    Is it possible to import the source file name and extension as well as the source file created date in the portfolio file details?  Need to document source to portfolio in working with 3rd parties that will only have the original source.  Need to document what was converted into pdf as not all files in a directory will successfully convert to pdf.  Sometimes need to convert 100's of files.  Manual entry is inefficient.  the file names and modified dates are displayed on the Combine Files dialog.  is there a way to capture the detail on that page?

    I don't need the detail of when the pdf was added to the portfolio.  I
    need know which dwg or jpg or word file was converted and the original
    created date of that file for control of information.
    That is impossible; sorry. For some *very specific* types of conversion to PDF the pdfx:SourceModified XMP tag will be set to show the last-modification date of the source file (for example DOCX files converted using MS Word), but there will never be a human-readable record of the source filename or its creation date unless you have manually added them as document XMP properties after conversion (this is what the "Custom Properties" dialog is for). To embed source data automatically would raise no end of privacy and security problems for customers, who most certainly do NOT want their recipients seeing details of internal documents.
    Without writing a plugin there's no access to the internal workflow of the Combine Files dialog, so you cannot use a script to read the names and dates of the files *before* conversion and store them automatically in the new PDF Portfolio's Fields array.

  • Best Practises for File Sharing and Print Server on Windows Server 2012

    Is it better to have File Sharing and Print Server installed on the same Windows 2012 Server ?
    Or, they should be installed on 2 different Windows Servers ?
    Hussien Sherief

    It will work just fine to combine them.
    But most people would recommend keeping functionality separate... if the budget allows.  That whole "single point of failure" concept.  If that server dies, you've lost both of those functions.

  • I can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name

    can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name. My original external has an error and needs to be reformatted but I dont want to lose this informations its my entire Itunes library.

    Sounds like the source drive is formatted as case sensitive and the destination drive is not. The preferred format for OS X is case insensitive unless there is a compelling reason to go case sensitive.
    Why can't you change the filename? Is it because the source drive is having problems?  If so is this happening with only one or two or a few files? If so the best thing would be to copy those over individually and then rename them on the destination drive.
    If it is more then you can do manually and you can't change the name on the source you will have to reformat the destination as case sensitive.
    Btw this group is for discussion of the Support Communities itself, you;d do better posting to Lion group. I'll see if a host will move it.

Maybe you are looking for