File navigation on OSX problem - how to use a filter function?

I work with file navigation atm using the JSX file objects and the openDlg method and quite frankly, it drives me crazy.

He has a crazy person decided it was a good idea to have the filter flag on the totally different openDlg method to Win and OSX? Under windows, you use a string for filtering, OSX he wants is a function!

I checked the documentation and also searched this forum and I can't even find an example of how to set up so that it works for Windows and OSX?

OK, so I found the syntax, but it still does not make sense.

fileMask = function(file){file.name.match(/\.psd$/i) ? true:false;}


Here we have the psd extension hardcoded in the regular extension. But what happens if we want it to be a variable? And what happens if t he file does not yet exist.

Basically I want is the user of:
Navigate to a folder

Set a file name

record.

The extension type must be locked!

Compared to the way of windows to do things, the way OSX to use a filtering function is too complex, absurd and downright annoying!

EDIT: I also discovered that you can not write a file on OSX name unless the file already exists. Come on! Is this the type of dialogue hurt or something?

Here is my script to request a file that handles the differences Win/Mac

function isWindows() {
  return app.systemInformation.indexOf("Operating System: Windows") >= 0
}
function isMac() {
  return app.systemInformation.indexOf("Operating System: Mac") >= 0
}
function promptFile(filter_extension) {
  var filter = null
  if (isMac()) {
       if (filter_extension) {
            var filter_regex = new RegExp("[^\.]*\."+filter_extension+"$")
            filter = function (file_entry) {
                 return filter_regex.test(file_entry.name)
            }
       } else {
            filter = function () { return true }
       }
  } else if (isWindows()) {
       if (filter_extension) {
            filter = filter_extension.charAt(0).toUpperCase() + filter_extension.slice(1)+"-files:*."+filter_extension
       } else {
            filter = "All files:*.*"
       }
  } else {
       filter = null
  }
  var f = File.openDialog("Select your file", filter, false)
  if (f) {
       return f.fsName.replace(/\\/g, "/") // sanitize to forward slash
  }
}
}

Tags: Photoshop

Similar Questions

  • How to use the goto function?

    How to use the goto function in indesign javascript?

    my script begins by chekcing if the input files are present or not... If one of the input files is not present, I want the n function put an end to the operation in the display of the message tht file exists... I was wondering to use goto for tht... then how to use it? or is there an alternative to that?

    GoTo is generally frowned upon by the programmers.

    The only legitimate use of goto is when you need to escape from a nested loop.

    If you need to jump into a routine, use break or simply in return from the current function.

    The model currently used by the SDK looks like this:

    do
    {
         if(condition1 == false)
              break;
         if(condition2 == false)
              break;
         if(condition3 == false)
              break;
         doSomethingReallyCool();
    }while(false);
    

    'break' the jumps at the end of the do / while loop that always comes out when you reach the end of it (while (false))

    Substances

  • How to use the @accum function in the calculation script

    Dear all.

    I'm new in essbase - calculation script so don't know how to use the @accum function.

    I want the aggregation value of child to parent

    Hierarchy

    Product

    100 > Storage Dimensions marked as stored (marked as intentionally as I want to calculate the value using the calculation script)

    100. 10 (+)

    100-20 (+)

    100-30 (+)

    I'm trying calculation Script

    100 = @Accum (@children("100"), jan: Feb);

    It works when I use below

    100 = @Accum("100-10",Jan:Feb);

    Error:-number of Dimensions [1] does not match number of gen/lev [3] office [@Dim]

    Don't know how I can roll up to an aggregate value of all the members of the child to the parent.

    Error.PNGhierachy.PNG

    you do this more difficult it must be. If you want to accumulate up to 100 then you could just make your calc

    '100 '.

    but that would be only 100, to make the OU any dimension would

    AGG (Product);

    Or better yet

    AGG (Product, Market);

  • How to use the NVL function in decoding?

    Hi all

    How to use the NVL function in decoding?

    SELECT Decode (Sign (sum (nvl (7), 0)-nvl (sum (5), 0)), - 1, 0, (sum (nvl (7), 0)-nvl (sum (5), 0)) QTY)

    of the double

    Thank you

    You should not do that...

    Greatest (NVL (Sum (Quantity), 0)-NVL (SUM (quantity_received), 0), 0) AS qty_arrival

    will do the same

    HTH

  • Oracle: how to use the max() function in expression box

    How to use the max() function in the case where expression, please explain with an example

    Hope this helps and should be explicit

    with t as
    (select 1 col,100 col2 from dual union
    select 2 ,100 from dual union
    select 2 ,200 from dual union
    select 3,100  from dual union
    select 3,200  from dual  )
    select col, case when max(col2)=100 then 'with 100 range'
    when  max(col2)=200 then 'with 200 range' end  from t group by col
    
  • How to use the TRUNC function with dates in the expression builder in OBIEE.

    Hello
    How to use the TRUNC function with dates in the expression builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns 1 July 2010"where sysdate is July 15, 2010 ' in SQL. I need to use the same in the expression builder in the logical layer mdb column.


    Thanks in advance

    Use it instead:
    TIMESTAMPADD (SQL_TSI_DAY, (DAYOFMONTH (CURRENT_DATE) *-1) + 1, CURRENT_DATE)

  • How to use the NVL function to a parameter with comma delimited values

    Gurus,

    It is confusing to me.  I am trying to use the NVL function, but the setting that I'm passing in my cursor contains multiple values with commas.  The NVL function is confused when analyzing the values.

    'Where' cursor clause...

    and nvl (sn.c_attribute1,'x@#$%') in nvl (p_desig,'x@#$%'( )

    translated parameter values...

    and nvl (sn.c_attribute1,'x@#$%') in nvl ('SPRT''GOOD' 'BAD' 'x@#$%') -NVL does not parse the value correctly

    Any idea on how to get NVL recognize 'x@#$%' , if p_desig is null?

    Thank you

    Scott

    HI, Scott.

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

    My best guess, based on what you posted bone is present, that your problem is discussed in the following:

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

    http://www.Oracle-base.com/articles/Misc/DynamicInLists.php

  • How to use the add_months() function in a mapping?

    Hello

    I have a variable in ODI with a date and I need to add another variable to add 'x' months...

    How can do that?

    Thank you

    If you say you have variable1 organise a date for example 01/01/2015 and variable 2 holding a certain number of months for example 7?

    If so in your mapping expression simply use the date functions available to your database technology (step/target) and replace the variable in the function

    that is for Oracle your mapping would be ADD_MONTHS (#Variable1,Variable2of #)

  • How to add a filter function in the navigation?

    Hello

    .. .this site has a pretty cool concept navigation based on a filter function:

    http://trufcreative.com/work

    2014-12-13_Filter-Function.35.1.png

    Any chance to build the same kind of functionality ("sort by") + (as a separate navigation level) with MUSE?

    Any advice would be much appreciated!

    G

    You can achieve this by using a code that currently there is no widget providing for sorting of the tales or elements.

    Where is hosted on Adobe servers, you can use web apps to achieve this goal. Sorting based on filters of points can be included in the web application page.

    Let me know if you use BC, I'll give you more information than the way you do.

    Thank you

    Sanjit

  • How to use the Substring function with Case statement.

    Hi all

    I have a requirement where I have to use the substring function on the ground for the report criteria.
    FOR EXAMPLE
    I branch domain name where I have all the information of the branch names, now some of the branch names are too large with an extension after the name.
    now I want substing it, but the length of characters varies for each branch.
    so is it possible where we use a box where we can define if the character of name plug exceed a value then he substing with this length.

    Try something like this:

    LENGTH WHEN CARTER (tablename. Branch_Name) > n THEN SUBSTRING (...) Of ANOTHER tablename. Branch_Name END

    where n is the number of characters that you want to start the break.

  • How to use a PIPELINED function shaped 10g?

    Hi guys,.

    When I tried to use a PIPELINED function in the forms, I got the message:

    -Function called from SQL PL/SQL must return the legal value of Type SQL

    FOR rec_dev IN (SELECT *)
    TABLE (p1196.f_executa (August 1, 2010 ", - pdDataInicial"))
    August 30, 2010 ", - pdDataFinal"
    5,-pnCodAdm
    NULL,--pnCdsCod
    NULL,--pnAdmsSrvCod
    NULL,--pnAcao
    NULL)))
    LOOP
    vnQtdeEstornos: = vnQtdeEstornos + rec_dev.qtde_estornos;
    vnVlrTotalCredito: = vnVlrTotalCredito + rec_dev.valor_credito;
    END LOOP;

    Can someone help me?

    Cree

    You can not. One possibility would be to wrap your function in the pipeline in a view, or you can write a stored procedure that returns a strong Ref cursor instead.

    see you soon

  • Lost after update... I have usb with the backup file to collect on it, how I use it to get back to speed dial and the history of the details for the 2 different versions of Firefox

    New version of Firefox result... No favorites especially No speed don't dial loads of them...

    Which may have been generated through:

    It was the best resource that I could find.

  • How to use the node function call library for a function in the dll with the data SUB type

    Hi all

    I would ask for your kind help

    I am facing a problem with the call library node.

    I have a C++ (stdcall) function, which has Sub as data type

    XXXX error code (hwnd, lid, getValue, * Sub data1, * Sub data2)

    data1 and data2 types are constantly changing based on the value of 'getValue '.

    Mainly I can use the call library node several times and adapt each node according to the types of data data1, data2 and extract the values and use in the code. Here is no question. Real question is:

    My question:

    How can I use a node of library time call and make a case according to the 'getvalue', who will control the data1, data2 data type. Here I really seeking solutions.

    My tests:

    I used varaints as entry to the libray call node of the data1, data2 and selected parameters in the call libraby node as "Adapt to type. Here labview just crashed.

    I appreciate your suggestions to feedbackand.

    Thank you

    Karine

    You must allocate enough space for data1 and data2, and then pass a pointer to this space. An easy way to do this is the function to initialize table. Set the U8 type and size for the number of bytes required. Pass this array to the function as a pointer of table data.

    After the function call returns, you need to extract the data in the table. You can do it manually, but a simple approach is to use the array of bytes to a string. Then, in a housing structure, use Unflatten chain to convert the string to the correct data type. This method also converts the "endianness" which will be probably necessary; Be sure to only set all entries for unflatten correctly.

  • make changes to a file, I don't create and now used to the function key

    I had to change the dimensions of the file so I am not changing the button actions.  So, it worked before, and now im in CC host trying to get it to work again.  Any ideas how to check where the url I need to go to url google.org

    Here's the AS3

    to import flash.external.ExternalInterface;

    // =========================== CLICKTAG STUFF ==================================

    // =============================================================================

    ct.addEventListener (MouseEvent.CLICK, handleClick);

    ct.addEventListener (MouseEvent.ROLL_OVER, handleMouseOver);

    ct.addEventListener (MouseEvent.ROLL_OUT, handleMouseOut);

    function handleClick(e:MouseEvent):void {}

    ExternalInterface.call("saveglobalscore",score) ("ctaClick");

    trace ("clicked... clicktag");

    / * var flashVars:Object = LoaderInfo (this.root.loaderInfo) .parameters;

    If {(flashVars.clickTag)

    navigateToURL (new URLRequest (flashVars.clickTag), "_blank");

    }

    trace ("clicked"); * /

    }

    function handleMouseOver(e:MouseEvent):void {}

    cta.cta.gotoAndPlay ("OVER");

    cta.gotoAndPlay ("over");

    }

    function handleMouseOut(e:MouseEvent):void {}

    cta.gotoAndPlay ("out");

    }

    do not change the fla.

    Use the original html code and change the object tag:

    width = "550" height = "400" id = 'test' style = "float: none;" ' vertical-align: middle ">

  • How to use FNDLOAD for functions, menus, and responsibilities

    Hi all

    I have a set of custom functions, menus, and responsibilities in an EBS 12.1.1 (Windows) I don't want to export using FNDLOAD.

    These exported objects can be imported again into a 11.5.10 EBS installation?

    I tried to export the menus by using this command:

    bin\FNDLOAD apps/apps@VIS 0 Y DOWNLOAD %FND_TOP%/patch/115/import/afscursp.lct resp.ldt FND_RESPONSIBILITY RESP_KEY = "TESIS_INVENTORY_SUPER_USER".

    and it worked OK (at least I think that was the case).

    But after the download in 11i system, menus are not there? What could be the problem? Here is the log:

    ---------------------------------------------------------------------------
    Application object library: Version: 11.5.0 - development

    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.

    module:
    ---------------------------------------------------------------------------

    Current system time is March 21, 2011 15:00:48

    ---------------------------------------------------------------------------

    Download from the menus.ldt of data file
    Changing environment NLS_LANGUAGE AMERICA database
    Dump files LCT/LDT (E:\oracle\visappl\fnd\11.5.0/patch/115/import/afsload.lct(115.58), menus.ldt) to stage tables
    LCT E:\oracle\visappl\fnd\11.5.0/patch/115/import/afsload.lct(115.58 dump file) in FND_SEED_STAGE_CONFIG
    Empty the LDT file menus.ldt in FND_SEED_STAGE_ENTITY
    Dumped the lot ( NULL , MENU MENU TESIS_INV_SUPER_USER) in FND_SEED_STAGE_ENTITY
    Download from stage tables

    ---------------------------------------------------------------------------
    Concurrent query ended with success
    Current system time is March 21, 2011 15:00:54

    ---------------------------------------------------------------------------



    Is it possible to export and import a menu without worrying about the functions used by the menu? So far, I don't have export and import functions and maybe I need to do this first!

    Thank you very much
    Konrad

    and it worked OK (at least I think that was the case).

    Please check the TDL file to check.

    But after the download in 11i system, menus are not there? What could be the problem? Here is the log:

    Is it possible to export and import a menu without worrying about the functions used by the menu? So far, I don't have export and import functions and maybe I need to do this first!

    If you have verified the data in the file ldt, please run FNDLOAD download command with 'WARNING = YES UPLOAD_MODE = REPLACE CUSTOM_MODE = FORCE' options and then check.

    Thank you
    Hussein

Maybe you are looking for

  • E-mail keeps demanding a password.

    I access my online POP e-mail account via Apple Mail.  I was randomly to a Mail message password required with the icon of the Apple mail logo on this subject. I checked with my online e-mail account (which works fine) and they say they can't help an

  • robokeeper program

    Hello I have a project and I want to do the program in lab mode I want to program to detect the ball only once I have movw robokeeper by servomotor I want to program to detect the ball I make the program but is not detect the ball his anu thing detec

  • daq6015 of prototyping area

    The DAQ6015 has an area of prototyping next to the input terminals. One of these blocks are reserved or carrying signals, or can I make connections anywhere? There are no leads on this field that I should know about?

  • USB ports not working not not touchsmart tm2

    I have a TouchSmart tm2-1070, which was very good for me. About 2 months ago the built-in wireless stopped working, and so I ended up finding a USB wireless modem. Then, each week, each of the three USB ports no longer works... first the two on the r

  • Windows 7 same thing updated every day

    my computer keeps updating the same thing again and again every day its never done this and I begin to feel that something is wrong, they are: A security update for .NET Framework 4 on Windows XP, Windows Server 2003, Windows Vista, Windows 7, Window