In javascript, how do I open a dialog so that the user can input the value of a variable?

I'm working on a script that will be used for many images, all of them using the same format (size of the image, layer layout, etc).
All of these images will have a layer of text, and what I want is to have the script modify the horizontal length of the text layer (horizontal percentage scale), shrinking it so that all of the text appears on-screen, in case there's too much of it.
But the text will vary from image to image, and what I want is for the script to display a dialog box were the user can input the text that will be put on the text layer and scaled down.
Can this be done?

If you want the user to both enter then fit the text while your script is running, here is one way to do that.
var typeLayer = activeDocument.activeLayer;
var type = typeLayer.textItem;
var t = prompt ("Enter text" , "new text");
type.contents= t;
transformLayer();
function transformLayer() {
     try{
     var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
    desc.putReference( charIDToTypeID('null'), ref );
    desc.putEnumerated( charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsa') );
        var desc1 = new ActionDescriptor();
        desc1.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Rlt'), 0.000000 );
        desc1.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Rlt'), 0.000000 );
    desc.putObject( charIDToTypeID('Ofst'), charIDToTypeID('Ofst'), desc1 );
    desc.putUnitDouble( charIDToTypeID('Wdth'), charIDToTypeID('#Prc'), 100 );
    desc.putUnitDouble( charIDToTypeID('Hght'), charIDToTypeID('#Prc'), 100 );
    desc.putBoolean( charIDToTypeID('Lnkd'), true );
    executeAction( charIDToTypeID('Trnf'), desc, DialogModes.ALL );
     }catch(e){}

Similar Messages

  • How to limit the max dialog no that one user can use at the same time?

    Hi,
    I meet one performance problem that one user can open 6 sessions in the GUI and he/she can run 6 reports at the same time witch could occupy 6 dialogs in the sap R/3 instance. It makes poor performance for other users.
    Would you pls tell me how to limit the no. of sessions one user can create at the same time or how to limit the no. of dialogs one user can occupy at the same time?
    Thanks a lot!
    I used this parameters in the default profile as blew:
    rdisp/rfc_check 1
    rdisp/rfc_use_quotas 1
    rdisp/rfc_max_own_used_wp 20 (means: 20%)
    It still didn't work.
    Sean

    Hello,
    We can reserve DIA W.P by giving value to the parameter :- rdisp/rfc_min_wait_dia_wp=1(default)
    that have to necessarily remain free for other users.
    This parameter is used to reserve a number of dialog work processes for Dailog mode.
    For eg. If 10 dialog w.p. are configured for the instance(rdsip/wp_no_dia=10) and the parameter rdisp/rfc_min_wait_dia_wp=3 is set,parallel RFC's can occupy a maximum of 7 DIA W.P.3 DAI W.P. always remain free for dialog mode.
    But now the question is how we assign/restrict this free dialog w.p. to the specific user.
    Reply...
    Regards,
    JUNAID

  • How do I set up a page that a user can edit online?

    I am setting up a simple website for a restaurant moxibistro.com. The client has asked me to set up a page for her "Weekly Special" She wants to be able to edit this page once a week with a different special. She doesn't have a mac so I'm thinking there has to be an online service that she could use for this page. Is there something that I could just embed the HTML of that page into iWeb and it will update as she changes it.
    I was thinking maybe she could use sites.google.com but I don't know if I could embed the page contents into my site or how I would make the theme look consistent.
    Any ideas?

    Basically, if your client does not have a Mac then don't use iWeb to create the site. iWeb is Mac only and if a client wishes to make alterations, then they need the domain file.
    If your client needs to update on a weekly basis, then why not consider using one of the online website creation packages where you can log in from any Mac or PC. This would be simpler and there are lots out there - Microsoft Office Live or Google or something like http://www.wix.com where you can create a site and use a domain name with it.
    Look at the alternatives before using iWeb.

  • How to Shw Open File Dialog Box

    Hi all,
    Can anyone help me plz.
    I am designing an interface using forms 9i where data entry operator has to insert data for products in the database. Also we want to store the image of the product. so I want to show an open File Dialog box from where user can pick a file and click ok & if it returns the file name with complete path, then i can read the contents of image using read_image_file.
    So, is there any Oracle built-in for that???
    Thanks in advance

    Thanks Ronald webutil worked successfully.
    But i am facing following error when i try to go to the Canvas provided by the Webutil setup(olb).
    Error is given Below:
    1. FRM-13008; Can't find java bean with name 'oracle.forms.webutil.ole.OleFunction'.
    Previously it was giving errors on all JavaBean classes then i put the path of webutil.jar file in registry as given in the documention. It works ok for other java beans but why above error is coming.
    plz Help.

  • How to disable Open File dialog in Preview

    After I upgraded from Mavericks to Yosemite, Preview app started popping up the Open File dialog box every time I launch it.  It used to just launch and do nothing.
    Is there a way to prevent Preview in Yosemite to present the Open File dialog box to the user?  I vaguely recall a "defaults write" kind of command that would disable this feature.
    The use case this behavior is breaking is as follows:
    1. Want to take a screenshot and save it to a file.
    2. Press Cmd-Ctrl-Shift-4 to snap a screenshot and save it on the clipboard.
    3. Cmd-Space to bring up Spotlight, type Preview and launch Preview
    4. Cmd-N to instruct Preview to paste the contents of the clipboard to a new file.
    With Yosemite, step-4 above breaks, since I have to hit Esc first to clear the dialog box.

    Try this it will give the full directory structure.
    REPORT  ZTEST3460  line-count 30(2)   .
    PARAMETERS: FILE LIKE RLGRAP-FILENAME.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.
                         CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
                         EXPORTING
                           DIRECTORY              = ' '
                           FILEMASK               = ' '
                          IMPORTING
                            SERVERFILE             = FILE
                         EXCEPTIONS
                           CANCELED_BY_USER       = 1
                           OTHERS                 = 2
    Cheers

  • What does the open file dialog do 'under the hood' and is there a way to simulate it

    What does the open file dialog do 'under the hood' and is there a way to simulate it?
    I have a bug in my code (that I've posted about before, here) which I can't fix at the moment, but I do have a workaround.
    Briefly, the bug:
    I call a dll from a function node, to initialise and run a spectrometer. If I start up the PC, LabVIEW and run my vi the code runs without complaint, the first call to the dll to initialise the spectrometer doesn;t return an error but the spectrometer is not detected either.
    I've tried various solutions, see the link above, and none work
    The workaround:
    If, at any time before running the code containing the function node I open an 'open file' dialog window, select the dll and click ok/hit enter then everything is fine. When I run the main code the spectrometer is detected.
    I use an express vi to open the file dialog, I specify the start path and file name as constant inputs and just click ok/hit return when the dialog pops up. I don't do anything with the dialog outputs. In fact the vi that contains the open file dialog can be run before the project containing the bug is even open.
    I have to do this everytime I turn the PC on.
    So, either
    1) Can somewone suggest a fix for the original bug?
    2) What is the easiest way to simulate the enter keypress when the open file dialog pops up
    or
    3) Can someone tell me what the open file dialog does under the hood that somehow causes the dll to work and can it be simulated in straight LabVIEW
    I suspect that the dll itself is dodgy ( I have in the past talked to the supplier but not got very far, and I will try again but I would like a quick, temporary solution too). I'm guessing that the file dialog is making some kind of check on the file, and possibly registering its presence with the OS (winXP). I tried using the file/folder exists vi to see if checking the file like that worked but no luck.
    Any help greatly appreciated.
    Dave

    Hi David
    I am very conscious about thread hijacking but this sounded like my issue so I hope you dont mind me asking about your issue. I am hoping that you have a spectrometer from the same vendor as me and its not just me seeing an Error 1097 issue. My spectrometer is from a company called Stellarnet.
    So far I have unable to get it to work with other VIs. There is one condition where I can get it to work but its no good for me.
    Case 1
    I open the VI in a fresh labview environment with no other VIs in memory. The code runs with no issue.
    Case 2
    Labview is not opened. I double click the spectrometer VI in windows explorer.  The VI opens but it fails to run resulting in Error 1097. Personally, I dont see the difference between this and Case 1 above and yet it fails.
    Case 3
    If I already have other VI's in memory and try to load the spectrometer VI and run it fails with Error 1097. This case is the one that most important to me. I have a test executive that will load test VIs dynamically and I can't get this to work. Same problem Error 1097.
    I wanted to share what I have seen with you and to let you know that maybe somebody else has the same issue. I am convinced its the DLL but the vendor dis-agreed saying it was LabVIEW. I couldn't convince him otherwise.
    Thanks in advance
    David

  • How do you open multiple email messages at the same time on Mail?

    Hi,
    are there any preferences to control how emails are opened from Mail client.
    Currently I can only open one emil at a time and can not toggle between messages or even toggle between the inbox view and a single message.  This is very frustrating especially if you want to toggle across multiple messages.
    Thanks for the help.

    Just figured it out - I can select multiple messages as you suggested when I am not in full screen mode.
    So once I come out of full screen mode - then the multiple windows open.
    QED

  • How to get the value of a variable defined in javascript in JSP

    how to get the value of a variable defined in javascript in/through JSP????

    In Javascript you can use the DOM to access the input element and set it's value before submitting the form. Then it's value will just be passed.

  • How do I open a .pdf file that I transferred to the ipod touch 5 using Itunes?

    How do I open a .pdf file that I transferred to the ipod touch 5 using Itunes?  It is shown in the Adobe Reader Documents window on Itunes. All help greatly appreciated!

    Is it not showing up in the documents tab when you open Adobe Reader?

  • How do I open a XLSM document on the iMac ?

    How do I open a XLSM document on the iMac ? I just get "Import Error".

    theislandguy wrote:
    How do I open a XLSM document on the iMac ?
    Use Microsoft Excel or a compatible app.
    I just get "Import Error".
    In what app? Or are we playing Twenty Questions?
    Excel 2008 should be able to open it, but not play any of the macros. Excel 2011 should be able to open it and play the macros -- unless they contain Win-specific code. OpenOffice/NeoOffice/LibreOffice's Calc should also be able to open it, but the extent to which it will be able to play the macros also depends on the code.

  • How do I open a GarageBand file that was emailed to me?

    How do I open a GarageBand file that was emailed to me?
    I have GarageBand...I just can't figure out how to get it to GarageBand from my yahoo email.

    I guess that is my problem...because I can't figure out how to save it. I forgot to mention that I'm using and iPad2 and not a pc or workstation. Thanks for the suggestion Christoph! Anyone know how I can save a garageband attachment from yahoo email to an iPad?

  • How do I open a form specific to particular user?

    Hi All,
    Please answer below questions:
    1) How do I open a form specific to particular user?i.e I want to open a form as enterable mode for one user and non-enterable mode for another user.
    2) How do I run a report specific to the particular user? i.e I want to run a report for one user here other user can not see the report.
    Thanks in Advance,
    Dhana

    1) How do I open a form specific to particular user?i.e I want to open a form as enterable mode for one user and non-enterable mode for another user.Create a new responsibility, and set QUERY_ONLY=YES -- See old threads for similar discussion.
    QUERY_ONLY
    http://forums.oracle.com/forums/search.jspa?threadID=&q=QUERY_ONLY&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    2) How do I run a report specific to the particular user? i.e I want to run a report for one user here other user can not see the report.Through "Concurrent: Report Access Level" profile option.
    Concurrent Report Access Level [ID 736547.1]
    R12 View Concurrent Requests FAQ [ID 1261985.1]
    Can't View Request's Output Submitted By Others [ID 949703.1]
    How to View the Output of a Request Launched by Someone Else [ID 413382.1]
    Thanks,
    Hussein

  • How do i open a created project that is in a file?

    Hi all,
    How do i open a created project that is in a file in NWDS 7.2?
    I tried the below method:
    1) created a dc
    2) Import-->General-->filesystem-->proceeded further.
    But there was no project.
    What am I doing wrong?
    Regards,
    Manoj.

    Hi,
    If it was exported as a DC project into a zip file, then simply File -- Import ... -- Existing project into workspace -- browse for the zip file.
    Regards,
    Ervin

  • How do you open a adobe document that i did on photoshop cc on ios. i want to do this because i want to post this photo on instagram

    how do you open a adobe document that i did on photoshop cc on ios. i want to do this because i want to post this photo on instagram@

    Ahh, you're likely right, station.
    If that is the case, why even bother with iOS? Doesn't Instagram let you upload on a desktop computer?
    @official_knicks: Use File > Save for Web to save your open document in a format Instagram accepts. (JPEG and PNG are the formats, I think.)

  • How do i open nikon d810 raw with the cs4 ?

    how do i open nikon d810 raw with the cs4 ?

    If a camera is not covered by your version of ACR, download a free copy of the Adobe DNG converter and convert the file. Your ACR will read the converted file.

Maybe you are looking for

  • IPhone 4s no longer syncs in iTunes with iOS 5.1 - "Waiting for sync to start..."

    Anyone else having this issue after the update from iOS 5.0.1 --> iOS 5.1 itunes sees the iPhone 4s, however syncing just hangs at the "Waiting for sync to start..." it eventually times out.  I tried via cable as well as over wifi

  • URGENT!  Idoc Message Type FIDCC2 Not Posting CO Documents

    Hi Everyone, Our company is just about to begin using message type FIDCC2 to post entries through FB60/FB65 and FB50.  When you manually enter an entry through any of these transactions, an FI, CCA and PCA document are all created simultaneously.  Ho

  • Loud fan and hot macbook

    Hi Just in the last week or so I've noticed my Macbook gets really warm after about half an hour or so and the fan (I think) gets really loud. I'm not normally running much maybe itunes and safari and thats it. Does anyone know what the problem might

  • Class Not Found: JDBC driver oracle.jdbc.driver.OracleDriver

    Does anyone can help? When I install the OpenBravo, I get the error shown below: Class Not Found: JDBC driver oracle.jdbc.driver.OracleDriver could not be loaded. I am using the Oracle XE, jdk1.5.0_06, Apache Tomcat 5.5.17.

  • Launch my site from Business Catalyst

    Hello everyone, I'm new here and recently I built my website in Muse. To Launch my new site from Business Catalyst and link it to my domain name,  do I need to subscribe to Business Catalyst and Muse? Thanks