[CS3][JS] How to get the file type of current document

Hi,
How to get the file type of current opening document (e.g., tif, jpeg, png) using JavaScript with Photoshop CS3.
I am using file object the open the files one by one in the folder (the files sometimes don't have the extensions).
If the current document is in tiff format then I need to convert to 8-bit, if its an Jpg image then needs to ignore the file.
Regards,
Karthik

Do you really need to know the file type? What about just checking the bit depth?
var doc = activeDocument;
if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) {//Not 8 bit
doc.bitsPerChannel = BitsPerChannelType.EIGHT;
//do your save etc
}else{
    //Ignore

Similar Messages

  • AI CS3 Plugin: How to get the file format that is selected in the "save as" dialog??

    Hi,
    Someone please help me in getting the file format that is selected in the "save as" dialog. I wanted to retrieve it in the string format.
    I tried sAIDocument->GetDocumentFileFormat. But i'm unable to implement it correctly. Is there a better way or How do I implement this? Precisely, I wanna get the value as a string when the user selects "save as .pdf".

    Do you really need to know the file type? What about just checking the bit depth?
    var doc = activeDocument;
    if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) {//Not 8 bit
    doc.bitsPerChannel = BitsPerChannelType.EIGHT;
    //do your save etc
    }else{
        //Ignore

  • How to get the File-Type from a BLOB-Column

    Hi all,
    I have the database table with the BLOB-Column. In this column are Word/Pdf/Excel/... files can be stored.
    Now I want to open these Files from Webforms.
    I can download the file from database to the client and then open the file with client_ole2.CREATE_OBJ('Word.Application');
    But I can not be sure that the file is a Word-Document.
    How can I know which application is saved in the BLOB-column?
    Regards

    Hi Francois,
    thank you.
    Unfortunatelly I do not know the interMedia functions. Can you send me an example with interMedia?
    I am working with your solution with WEBUTIL_HOST.blocking.
    But when I do not give the extension for the file, in that the BLOB will be temporary stored, I get to see the Windows "Select Program..." window. When I select Word or anything else then the file will be opened, but the locking does not working.
    Any ideas?
    Regards

  • Getting the file type from a placed file

    Hi
    I am trying to get the file type from items placed on a page. I know the types available has one of the three interfaces "IImageAttributes", "IEPSAttributes" or "IPDFAttributes", but how can i test whether the placed image is a TIF, JPG ... Of course i could test on the suffix or the file type (mac), but that isnt "secure" enough, since InDesign can place files with no filetype or extension, if they are in an importable format.
    What I want in short, is to read the filetype shown in the Info palette, any one knows how to do this?
    Jon

    Thanks, I did take a look in these interfaces, but that didnt solve the problem for eps, pdf and other none raster types.
    Instead I found the:
    IDataLink->GetNameInfo()
    Which gives me the string from the Info palette.

  • How to find the file type without the file extension using indesign javascript (.jsx)

    hi,
    How to identify the file type (eg: InDesign or Quark) without knowing their file type. How can we find what kind of file is that??? without their extension like ('.indd','.qxd') before import to the document...

    Hi subha_oviya,
    Take a look at the file filtering section in the InDesign CS3 sample script ImageCatalog.jsx to see how to look for file types. I'm assuming that you're using InDesign CS3, and that you're using the Mac OS--you didn't say.
    Thanks,
    Ole

  • How to get the files in presentation server while uploading?

    how to get the files in presentation server while uploading?
    give me the function module name

    Hi,
    PARAMETERS:  P_FILE LIKE RLGRAP-FILENAME DEFAULT C_PRES.  "Prsnt Srvr
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          DEF_PATH         = P_FILE
          MASK             = ',..'
          MODE             = '0 '
          TITLE            = 'Choose File'
        IMPORTING
          FILENAME         = P_FILE
        EXCEPTIONS
          INV_WINSYS       = 1
          NO_BATCH         = 2
          SELECTION_CANCEL = 3
          SELECTION_ERROR  = 4
          OTHERS           = 5.

  • How to get the file size (in bytes) for all files in a directory?

    How to get the file size (in bytes) for all files in a directory?
    The following code does not work. isFile() does NOT recognize files as files but only as directories. Why?
    Furthermore the size is not retrieved correctly.
    How do I have to code it otherwise? Is there a way of not converting f-to-string-to-File again but iterate over all file objects instead?
    Thank you
    Peter
    java.io.File f = new java.io.File("D:/todo/");
    files = f.list();
    for (int i = 0; i < files.length; i++) {
    System.out.println("fn=" + files);
    if (new File(files[i]).isFile())
         System.out.println("file[" + i + "]=" + files[i] + " size=" + (new File(files[i])).length() ); }

    pstein wrote:
    ...The following code does not work. Work?! It does not even compile! Please consider posting code in the form of an SSCCE in future.
    Here is an SSCCE.
    import java.io.File;
    class ListFiles {
        public static void main(String[] args) {
            java.io.File f = new java.io.File("/media/disk");
            // provides only the file names, not the path/name!
            //String[] files = f.list();
            File[] files = f.listFiles();
            for (int i = 0; i < files.length; i++) {
                System.out.println("fn=" + files);
    if (files[i].isFile()) {
    System.out.println(
    "file[" +
    i +
    "]=" +
    files[i] +
    " size=" +
    (files[i]).length() );
    }Edit 1:
    Also, in future, when posting code, code snippets, HTML/XML or input/output, please use the code tags to retain the indentation and formatting.   To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.  It took me longer to clean up that code and turn it into an SSCCE, than it took to +solve the problem.+
    Edited by: AndrewThompson64 on Jul 21, 2009 8:47 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to open the file types of iOSApp(ipa),EPUBFile(.epub) in windows 7(32 bit)

    How to open the file types of iOSAPP(ipa),EPUBfile(.epub) in windows 7(32 bit)

    iOS apps can be added to an iTunes library and thereafter transferred to an iOS device. They cannot be opened directly on a PC.
    epub files can be added to an iTunes library, and thereafter transferred to an iOS device where they can be read with the iBooks application. Files protected with Apple's DRM cannot be opened directly on a PC, though there are programs such as Kindle and Calibre that will open non-protected epub files.
    tt2

  • How to get the Database type from weblogic Db connection

    I want to use database version control in my application . that means different database type use different Sql Statement. Such as in weblogic7.0 if I create SqlServer JDBC pool then I will use some special Sqlserver sql Statement . such as some join statement. If I create Oralce JDBC pool then I have to use different Sql statement . because these two database support different Sql statement.
    What my question is how to get the database type from the connection.

    For a normal jdbc driver you can use
    Connection.getMetaData()
    To get the meta data, in particular the getDatabase...() methods.
    That might or might not work.
    However, at the very least in the server you have access to the weblogic properties so you can parse the pool property to figure it out.

  • How to change the file type from IMOVIE PROJECT to other types of file

    how to change the file type from IMOVIE PROJECT to other types of file??
    thank you very much for your help=]

    I am not sure what you mean, but once you make a project. Then go to the share menu and you can export the project to iDVD, itunes, mobileme, quicktime.
    Share export quicktime movie will allow you to export to a variety of codecs. What specific export are you looking to share the movie in? What is the final source that the movie will be displayed?

  • How to get the link of already archived document

    Dear all,
    How to get the link of already archivied document. for example i have a sales order for which subsequent documents have been archived. now i want to get the link of subsequent document.
    please give some solution
    Thanks in advance
    Thanks,
    Hemachandran.

    Hemachandran,
                The archiving object for sales order is SD_VBAK. If you run the program S3VBAKAU by transaction se38 and search based on the document numbers ( as you mentioned it is the preceeding document numbers to the current document), you will be able to retrieve the information regarding the previous sales orders.
    More information on the sales order archiving object can be found at,
    http://help.sap.com/saphelp_45b/helpdata/en/a9/55c7b690a111d1a5510000e82deaaa/content.htm
    Sojan
    <<text removed by moderator>>
    Edited by: Matt on Nov 16, 2008 5:08 PM - Do not request points

  • How to get the MIME type of the given file in R/3

    Dear Experts,
    Please tell me the FM or Class to get the given file MIME type in R/3 . I am using GUI_upload Function module to upload the file in R/3 .
    Edited by: balaji ramadas on Jan 16, 2009 5:39 AM

    Thank you Prosenjit I m using this FM   CV120_GET_MIME_TYPE
    to get the MIME type of the file
    regards,
    Balaji.R
    Edited by: balaji ramadas on Jan 19, 2009 9:24 AM

  • How to get the file name in one of the Xml node field?

    Hi Experts,
    i have one requirement with file name in xml file.
    i need to get <b>the file name of file</b> in one of the node in xml content of that file.
    how can i achieve that req?
    treat this as Very Urgent.

    Hi Bheem,
    Explain your scenario in detail..
    >>i need to get the file name of file in one of the node in xml content of that file.
    1. Create an node <b>Filename</b> in the target datatype.
    2. Check the Option Filename in the Adapter Specific Message Attributes in the sender file CC.
    3. Use the following UDF and map it to the Filename field in the target message type.
    public String getFileName(Container container)
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName; 
    Regards
    San

  • How to filter the file type and size when uploadind files into APEX

    Hi,
    I was wondering how I can do to validate the size of a file, before moving it to my table ? I'd like to filter the file type, but for this one, I think I can use regular expressions in a validation process.
    I don't know if there is a way to read the file size even before sending it into the temporary file table.
    Thank you
    Leinad

    Hello Leinad,
    AFAIK, you have to create an APEX validation (PL/SQL returns Boolean or Returns error text), which will query the file details from apex_flow_files table. Here you can get filetype and size etc.
    So just validate and if any validation fails, then delete the file from apex_flow_files and riase error message.
    Regards,
    Hari
    P.S. Please note that, if there are other apex validations on your page and if they fail, still apex will load the file into apex_flow_files table. So it's good idea to create a validation (PL/SQL) which will fire (condition) when inline validation errors occured. Make sure that this is the LAST validation on your page in sequence. And here you can write code to delete the file from apex_flow_files table.
    Edited by: Hari_639 on Sep 20, 2012 10:09 PM

  • File Adapter - how to get the file count from a folder

    Hi All,
    I have a requirement that have to poll a directory when the file count is reached to number N (ex:number of files avilable in folder is 5) otherwise it should wait and not pick any of the files. Is it possible to get the file count from a folder using file adapter ?? otherwise please suggest me an approach to achieve this requirement.
    Thanks,
    JJ

    Hi Sarath,
    Thank you for your reply.
    Go with the list files operation of file adapter it will gives you the number of files in the specified folder as you given. . - this step is already done.
    When the number of files reaches your count startup your webservice that which can polls the files. . . - how can i acheive this?? Have to poll the directory and process the number files - please let me know, what could be added to the webservice which is being invoked after cheking file count from parent process.
    The reason for the above question is - we cannot use ReadFile operation in second webservice because it will be automatically triggered when the file is avilable. Also SyncRead operation supports reading one file in b/w bpel process. Kindly explain me the implementation steps.
    Thanks,
    JJ

Maybe you are looking for