Display Dialog button misbehavior

-- This is not an earth-shattering matter, but I've wondered if others have encountered some inconsistent button behavior with 'Display dialog'
-- For example, consider the following, which wasn't misbehaving when I posted this
display dialog "Go" buttons {"OK", "Quit"} default button 1 cancel button 2
--What happens sometimes is that button 1, although properly highlighted in the display, won't respond to the return button (must be clicked on directly). This behavior is usually consistent for a given display, while other displays in the same script may behave properly.
-- Other Info:
-- I've tried using the button name rather than number (no difference).
-- I can't be certain, but I think displays with default answers have never misbehaved for me.
-- This is something I've observed on and off for months, but have never really pursued it.
-- I've found nothing about the affected displays that seems unusual or atypical.
-- I'm not expecting a work-around (although that would be great), just wondering if others see this.
--TIA

The simplest way to do this is to create a stay-open applescript application with the following code:
on quit
          display dialog "Please Backup Your Data
There is a risk of data loss if the machine experiences a hardware failure or an accident occurs" buttons {"Log Out", "Cancel"} default button "Cancel" with icon stop
          if button returned of result is "Log Out" then
                    continue quit
          end if
end quit
and then run it at startup.  when the user tries to logout, the on quit handler will run and the program won't quit unless they choose logout; otherwise the program won't quit and the logout will be canceled.

Similar Messages

  • Japanese characters in display dialog buttons

    I would like to have Japanese characters on the face of display dialog buttons. Is this possible, and if so would someone suggest a method for doing so. Thanks in advance.

    Simple really, let say you like to have two buttons あい and いあ .
    You need to make two text files, one for each button with the above content (they need to be Unicode text file).
    Call them test1.txt and test2.txt, put them on your desktop.
    then try this:
    -- begin
    tell application "Finder" to set home_desktop to desktop as string
    set _test1 to read file (home_desktop & "test1.txt") as Unicode text
    set _test2 to read file (home_desktop & "test2.txt") as Unicode text
    display dialog "test" buttons {_test1, _test2}
    -- end
    To have everything in self-contain script, you have to save the script as application bundle, add the text files to the bundle and refer to their correct path within the bundle.

  • Applescript buttons returned from display dialog

    Hi!
    I have been learning Applescript for about a month and found the following issue which I thought was an easy implementation.
    On the "text returned" I get the error condition described. Do not understand!
    Any help would be appreciated.
    display dialog ("ENTER COMPANY NAME") with title ("TOTAL SHARE SPECIFICATION")
    buttons {"Cancel", "Company"} default button "Company" default answer ""
      set BUTTON_Returned to button returned of the result
      set CompanyName to text returned of the result
    error "Can’t get text returned of \"Company\"." number -1728 from text returned of "Company"
    MacBook 6.1     OS X Yosemite     Vn 10.10.1
    Script Editor  Vn. 2.7 (176)
    Applescript 2.4
    Regards

    No question that Applescript can be frustrating to learn. Many things about it have to be figured out by trial and error and when dealing with scripting applications all bets are off. The application designer can pretty much do as they want so what works in one app might not work in another even though you are using the same and correct applescript
    I find Introduction to AppleScript Language Guide by Apple to be a good source of answers and usually always have it open when I'm scripting  for quick reference.
    Spend some time getting familiar with the script editor. It is intelligent and can usually steer you in the right  direction when it comes to debugging.  Especially get use to and pay attention to the colors it assigns to items in your script.
    For example in your original script notice the colors of Button_Returned and CompanyName (your variables) and compare those to result and button returned. Also notice how text returned is a different color from button returned even though both are essentially the same thing. This is an indication that something is not right and it is where the error message occurred. (for a list of the default colors used open the Script Editors preferences and look at the Formatting tab).
    Notice  also how the editor formats your scripts, again the way the script gets formatted can tell you a lot if there is an error.
    Finally the error messages while cryptic can offer some clues. In your case the error message was
    error "Can’t get text returned of \"Company\"." number -1728 from text returned of "Company"
    generated by the line
    set CompanyName to text returned of the result
    The last part of the error message is essentially the line that caused the error after evaluation. So here result evaluated to “Company” which doesn't seem right, display dialog returns a record.
    Finally there is the log statement which will print its value to the log window
    Hope this helps
    regards

  • Display dialog, getting both text returned and button returned

    I am most of the way through my first major project in applescript. I want to get both the text returned of and the button returned of a dialog box. Is this possible?
    So basically i want to do the below without having the dialog box run twice.
    set thebutton to the button returned of (display dialog "Already Assigned!" & return & "Please assign a new letter" default answer "…" buttons {"Cancel", "Delete Previous Location for this Letter", "OK"} default button "OK")
    set theLetter to the text returned of (display dialog "Already Assigned!" & return & "Please assign a new letter" default answer "…" buttons {"Cancel", "Delete Previous Location for this Letter", "OK"} default button "OK")
    Rich

    Well thanks for the fast response, both work fine, cheers. That problem is now sorted.
    However while i was waiting for the responses i came across another problem, i would like to delete a specified item from a list. This is not the actual script but i was using it to test the syntax. So basically how would i go about deleting the the letter P from a list PQ
    set letterlist to {}
    display dialog letterlist as string
    set namep to "P"
    copy (namep) to end of letterlist
    set nameq to "Q"
    copy (nameq) to end of letterlist
    display dialog letterlist as string
    set theKeyPressed to "P"
    repeat with each_item in letterlist
    if each_item contains theKeyPressed then
    delete each_item
    end if
    end repeat
    display dialog letterlist as string
    Rich

  • IFrame in jQuery Dialog - submit iFrame using dialog button

    Hi Everyone,
    I know a lot of us are using JQuery modal dialog feature and some of us using iframe strategy to display form or page inside of modal dialog popup. Personally, I am using these features a lot in my app but there is a step where I am a bit stuck.
    Here is my situation ( I am sure most of us will be interested in this to be resolved if not yet):
    I have a regular page (will call it parent page), on this page I have a button and by clicking on this button I am getting a jquery modal window popup. The button itself is pointed to url: javascript:LinkAssets(); and the script to call modal popup with iFrame in HTML Header of parent page is:
    <script type="text/javascript">
    // Link Assets - Modal PopUp
        function LinkAssets(){
    var apexSession = $v('pInstance');
    var apexAppId = $v('pFlowId');
    var assetNumber = $v('P17_ORDER_ID');
    $(function(){vRuleBox = '<div id="LinkAssetsBox" title="Link Assets to the Order">
       <iframe src="f?p='+apexAppId+':55:'+apexSession+'::NO:55:P55_ORDER_NUMBER:'+assetNumber+'"
         width="680" height="320" title="Link Assets to the Order" frameborder="no">
       </iframe>
       </div>'
    $(document.body).append(vRuleBox);
    $("#LinkAssetsBox").dialog({buttons:{"Close":function(){$(this).dialog("close");}},
                                                                   stack:true,
                                                                   modal:true,
                                                                   width:700,
                                                                   height:340,
                                                                   resizable:true,
                                                                   autoResize:true,
                                                                   draggable:true,
                        close: function(){$("#LinkAssetsBox").remove();
                                                             location.reload(true);}
    </script> As you see I am calling page 55 from jquery script into iFarme which will be displayed in modal dialog. All described above is working fine, no problems and most of us use it.
    My problem is here: my JQuery modal dialog has a "CLOSE" button which allows me to close a modal dialog without any changes and go back to my parent page - which is normal behavior. In my iFarme page (page 55) i have an "apply changes" button, and this button calls a process on page 55 by submitting a value and than it closes the modal dialog. "APPLY Changes" button has pointed to the url: javascript:UpdateRecord(); and page 55 has a script in HTML Header to submit value and close modal dialog:
    <script type="text/javascript">
    // -- Function to apply changes and close Modal Dialog--
    function closePopup(){     
       $(function(){parent.$('*').dialog('close');});}
    function UpdateRecord(){doSubmit('APPLY_CHANGES');closePopup();}
    </script> So, what I want is not to have this "Apply Changes" button in my page 55 which is iFrame page, I want this button to be next to my jQuery modal dialog "CLOSE" button which means I have to change my modal dialog popup script to include "APPLY CHANGES" button where this button will submit value to iFrame page and close my dialog.
    I hope whatever is above is readable and understandable.
    Thanks

    since my previous solution didn't work I did try another way. I did try to create a hidden item in my iFrame page -> pass a values "APPLY_CHANGES" to this item from my "ADD" button in parent dialog window and make my DML process in my iFrame (page 55) to fire conditionally when hidden item in iFrame page has "APPLY_CHANGES" value. So, I did change my dialog window script with iframe again to include this:
    $(document.body).append(vRuleBox);
              $("#LinkAssetsBox").dialog({
                            buttons:{"Close":function(){$(this).dialog("close");}
    //from here ---------------
    ,Add:function(){location.href="f?p=&APP_ID.:55:&SESSION.::NO:55:P55_CREATE_REQUEST:APPLY_CHANGES"}
    //to here -----------------
    },               stack: true,
                   modal: true,                         
                            width: 950,
    ...and again....it passes the "APPLY_CHANGES" value to my iFrame page item ( i can see that in session view) but my process is not running or may be it is not getting values of my form items in iFrame page.
    Any ideas...comments on this???

  • Change/display dialog program

    Hello all,
    I am using dialog program to display the records on the screen. On screen layout i declared all fields as output fields only. Now I want to add a button (change/display) on to screen so that when ever i press the button the screen has to change from display to change mode(just like the normal display/change button in se38) and vice versa so that i can edit the fields and save it again.
    I would like to know if there exists any function module to do so or can some one please help me with a code.
    Thanks to all in advance.

    Hi Madhu,
    Define your fields as input/output fields. In the PBO, you can either turn them on or off by applying the logic below.
    LOOP AT SCREEN.
      IF SCREEN-NAME   = 'ABC' OR
        SCREEN-GROUP1 = 'TEST'.
        SCREEN-INPUT = 1. " Make it editable field
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
    If you do SCREEN-ACTIVE = 1 or 0, you are actually showing or hiding the field itself, but if you do SCREEN-INPUT = 1 or 0, you are just making the field editable or display only.
    Srinivas

  • Advanced Dialog button not showing during "Get photos from camera or card"

    Based on previous threads, I have double checked my screen resolution (currently set at 1920x1080) and uninstalled/reinstalled PSE 8.  I run on Windows 7.  Has anyone has success getting the Advanced Dialog button to appear?

    A little experimentation shows that your Windows display text-size setting (DPI, dots-per-inch) is set too large, probably 150%. When I set my display to 1920 x 1080, I can set the text size to as large as 140%, but any larger and the Advanced Dialog button won't show.   To change the text size, right-click the Windows desktop, select Personalize, Display, Set Custom Text Size (DPI), and then enter a different value.
    PSE 8 has an undocumented "feature" that disables the Advanced Dialog when it won't fit on the screen.  This commonly occurs on netbooks with display heights less than 768, but it appears to happen also when the combination of display resolution and DPI make the dialog too big to fit.   Lazy programming on the part of Adobe.

  • Applescript & Automator- display dialog title

    I'm trying to make an Automator service. For one of the steps I would like to use an Applescript that looks something like the one below.
    set dpaste to "Enter a title, press tab, add some text, and click Continue when you're done."
    set dialog_title to "Post To Blog"
    set dpastedialog to display dialog dpaste with title dialog_title with icon 1 buttons {"Cancel", "Continue"} default button 2
    if button returned of dpastedialog is "Continue" then
    tell application "System Events"
    activate
    keystroke "v" using command down
    end tell
    end if
    However, the line "set dpastedialog to display dialog dpaste with title dialog_title" seems to be giving Automator some trouble. Whenever I try to compile/run the script, I get the following error message from Automator: "Expected end of line, etc. but found identifier" with the variable "dialog_title" selected.
    When I run this script from Applescript Editor I get no trouble.
    Thanks!

    Test the script in the AppleScript Editor until you resolve the issue. Alternatively, post to the AppleScript forum under OS X Technologies.

  • AS Droplet in XCode - Problem with display dialog with title

    hi,
    i am using XCode to create an AS droplet.
    wondering why i cant set a title to my display dialog code.
    during search in this forum i found this thread:
    http://discussions.apple.com/thread.jspa?messageID=6364939&#6364939
    but to be honest, i didn't expect that i am limited in Xcode too.
    Short code example:
    display dialog "foo"
    works
    but
    this code:
    display dialog "foo" with title "bar"
    not.
    Would be great to find a workaround to get dialogs with titles.
    And on the other hand to understand why i cant use title in Xcode.
    btw: is it possible to format the output of a display dialog ?
    i.e. creating new lines ?
    best regards
    fidel

    Hello
    I'm not sure but you may try 'run script' to invoke 'display dialog' of Standard Additions.
    Something like this.
    --SNIPPET
    set t to "line 1
    line 2
    line 3
    line 4"
    run script "display dialog \"" & t & "\" ¬
    with title \"Testing\" ¬
    buttons {\"OK\"} default button 1"
    --END OF SNIPPET
    As for 'display dialog' in AS Studio, it differs from and overrides 'display dialog' command in Standard Additions. Don't know why it does not have 'with title' which is rather new parameter introduced with AS 1.10 (OSX 10.4).
    cf.
    AppleScript Studio Terminology Reference (pdf)
    Panel Suite > Terminology > Commands > display dialog
    Regards,
    H
    Message was edited by: Hiroto

  • Missing Advanced Dialog button

    Somehow the "Advanced Dialog" button is missing from the Photo Downloader box of my Elements 8. Does anyone have the same problem and know how to fix it?  Thanks.

    John,
    As mentioned yestda, i deleted and re-installed the Element 8 on my computer. It went very smoothly, no problem whatsoever. Then i tried everything you mentioned in your emails. Nothing helped. The 'Advanced" option did not show up at all in the Preferences box, nor on the Downleader box. I can't think of anything else to try other than call the Tech support of Adobe, unless you or someone else can suggest something else to try. I am willing to try anything. Thanks a lot for everyone's help.
    Regards, DukeF5
    Date: Mon, 8 Feb 2010 11:47:39 -0700
    From: [email protected]
    To: [email protected]
    Subject: missing Advanced Dialog button
    Does "'Show APD Dialog (Advanced)" appear as an option in that drop-down list, as shown here:
    http://forums.adobe.com/servlet/JiveServlet/showImage/19683/capture.png
    If it doesn't, then that's an additional indication that your PSE is getting confused about the display height.  (When the height is less than 768, PSE won't show the Advanced option in the drop-down box.)  Whether that's a bug in PSE or a problem on your computer, who knows.
    Did you try steps 2-4 from my previous message?
    >

  • How to don't display dialog after send data on BPC for Excel?

    Dear experts,
    I don't want to display dialog after send data on BPC for Excel, how can I do that?
    OS: MS XP SP2
    OFFICE : 2003
    BPC : 7.5 NW

    Hi,
    You need to change the macro assigned to the standard button. There are few macros available. You can try them and see which one suits you the best.
    MNU_eSUBMIT_REFSCHEDULE_BOOK_CLEARANDREFRESH: Sends workbook and clears data and refreshes workbook.
    MNU_eSUBMIT_REFSCHEDULE_BOOK_NOACTION: Sends data without clearing or refreshing the worksheet.
    MNU_eSUBMIT_REFSCHEDULE_BOOK_NOACTION_SHOWRESULT: Sends data without clearing or refreshing the worksheet, and shows the result in a window upon successful send.
    MNU_eSUBMIT_REFSCHEDULE_BOOK_NODIALOG_SHOWRESULT: Sends active book without any dialog and show result box.
    MNU_eSUBMIT_REFSCHEDULE_BOOK_REFRESH: Sends workbook and refreshes data.
    MNU_eSUBMIT_REFSCHEDULE_SHEET_CLEARANDREFRESH: Sends data and clears and refreshes the worksheet.
    MNU_eSUBMIT_REFSCHEDULE_SHEET_NOACTION: Sends data without clearing or refreshing.
    MNU_eSUBMIT_REFSCHEDULE_SHEET_REFRESH
    Hope it helps.

  • AppleScript Newbie - Display dialog box when quitting an application

    Hello.
    I was wondering if it's possible to write a script that displays a dialog box (in this case one saying "BACK UP!!!!") everytime i quit Final Draft.
    Thanks.
    F.

    A regular AppleScript does not have the ability to get system notifications, so you would have to do something like have the script continually check (poll) for applications that are running.  A Cocoa-AppleScript does have the ability to do Cocoa-y stuff such as register for system notifications, so you can create a new applet (AppleScript Editor > File > New from Template > Cocoa-AppleScript Applet), paste in the following, and save it as an application (uncheck the option to show the startup screen):
    property theApps : {"Final Draft"} -- a list of applications to watch for
    on run -- example
      # add observers for workspace notifications
      tell current application's NSWorkspace's sharedWorkspace's notificationCenter
        addObserver_selector_name_object_(me, "appQuit:", current application's NSWorkspaceDidTerminateApplicationNotification, missing value)
      end tell
      -- tell application "Final Draft" to activate
    end run
    on appQuit_(aNotification) -- an application quit
      # aNotification's userInfo record contains an NSRunningApplication instance that we can get properties from
      set theApplication to (aNotification's userInfo's NSWorkspaceApplicationKey's localizedName()) as text
      if theApplication is in theApps then
      tell current application -- me
        beep 3
        activate -- make sure dialog comes to front
        display dialog "BACK UP!!!!" with title "Final Draft quit notice" buttons {"OK"} default button 1
        quit
      end tell
      end if
    end appQuit_
    When the application is run it will sit there and receive notifications when other applications quit, and checks to see if it was the application you want.

  • Missing Advanced Dialog Button in Photo Downloader

    I am running elements on an HP ENVY 14 Windows 7 laptop.  The Advanced Dialog button does not appear as an option when I download from my camera.  I understand it may be designed this way to prevent the option from running on smaller displays.  My display is set up at 1366x768 which is the maximun available on this display.  Is there a configuration option I can change to use the advanced dialog feature?

    Go to the control panel and check dpi scaling under Appearance or Display.
    It’s not uncommon to see a setting of 125% or higher to improve screen readability but PSE9 requires a dpi of 96 or 100%
    Whilst the Editor Menu will appear at 120% the Organizer Menu (and the advanced button in downloader) won’t.
    Try a setting of 115% or 116% otherwise 100%. A common display resolution, notably for laptops and netbooks is 1024 x 768 but PSE9 requires a screen height of 800 for full functionality.

  • Multiple entries by user in display dialog?

    Looking to prompt a user of an applescript to enter two variables in that I will then export to Excel. Can I display a dialog box that prompts the user for two pieces of data? I've heard of Applescript studio or something like that name...is this more in that realm? Here is the script I have so far for prompting the user for the info, except that it is a series of dialog boxes. Looking to make it concise and have all the info entered at once.
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    set slots to {"A", "B", "C", "D", "E", "F"}
    set rooms to {"1 ", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
    set chosenslot to (choose from list slots with prompt "What slot does your first class go into?  Choose one." without multiple selections allowed) as text
    if chosenslot is not "false" then
    display dialog "You chose " & chosenslot & ". Next choose the course to go into this slot"
    set chosencourse to (choose from list rooms with prompt "What course will go into slot " & chosenslot & "?   Choose one." without multiple selections allowed) as text
    display dialog "So " & chosenslot & " will be put into " & chosencourse & " CORRECT??"</pre>
    dan

    If the default answer of a dialog contains a return, then you can +use a return in the answer+ (in this case, the return key won't be used for the default button, although the enter key will still be used). Going a little bit further than casdvm, but using the same idea (using a return as a delimiter between items), you can fake a multiple input dialog. I have a general purpose handler that will get multiple input items (it is a bit long but has a lot of options):
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    on run -- example
    set {Slot, Course} to (InputItems for {"• Class slot", "• Course"} with Prompt given Title:"Data Entry")
    display dialog "Slot:  " & (quoted form of Slot) & return & "Course:  " & (quoted form of Course) with title "results"
    end run
    to InputItems for SomeItems given Title:TheTitle, Prompt:ThePrompt
    displays a dialog for multiple item entry - a carriage return is used between each input item
      for each item in SomeItems, a line of text is displayed in the dialog and a line is reserved for the input
        the number of items returned are padded or truncated to match the number of items in SomeItems
    to fit the size of the dialog, items should be limited in length (~30) and number (~15)  
    parameters - SomeItems [list/integer]: a list or count of items to get from the dialog
    TheTitle [boolean/text]: use a default or the given dialog title
    ThePrompt [boolean/text]: use a default or the given prompt text
    returns [list]: a list of the input items
    if ThePrompt is in {true, false} then -- "with" or "without" prompt
    if ThePrompt then
    set ThePrompt to "Input the following items separated by returns:" & return & return -- default
    else
    set ThePrompt to ""
    end if
    else -- fix up the prompt a bit
    set ThePrompt to ThePrompt & return & return
    end if
    if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" title
    set TheTitle to "Multiple Input Dialog" -- default
    else
    set TheTitle to ""
    end if
    if class of SomeItems is integer then -- no item list
    set {TheCount, SomeItems} to {SomeItems, ""}
    if ThePrompt is not "" then set ThePrompt to text 1 thru -2 of ThePrompt
    else
    set TheCount to (count SomeItems)
    end if
    if TheCount is less than 1 then error "InputItems handler:  empty input list"
    set {TheItems, TheInput} to {{}, {}}
    repeat TheCount times -- set the number of lines in the input
    set the end of TheInput to ""
    end repeat
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SomeItems, TheInput} to {SomeItems as text, TheInput as text}
    set AppleScript's text item delimiters to TempTID
    set TheInput to paragraphs of text returned of (display dialog ThePrompt & SomeItems with title TheTitle default answer TheInput) -- with icon caution with hidden answer)
    repeat with AnItem from 1 to TheCount -- pad/truncate entered items
    try
    set the end of TheItems to (item AnItem of TheInput)
    on error
    set the end of TheItems to ""
    end try
    end repeat
    return TheItems
    end InputItems
    </pre>
    If you are looking at easier error handling or an entry box for each item, then yes, AppleScript Studio is what you want.
    Message was edited by: red_menace

  • Display dialog delay quit

    Currently, my script displays a dialog and plays a sound. I can hit Ok and the sound stops and the script quits - that's all good. However, I would also like the script to automatically quit after a set number of seconds if no one hits Ok. Here's what I've got:
    tell application "Play Sound"
    activate
    play soundAlias repeat 3
    display dialog "Currensys Alert" buttons {"OK"}
    stop
    quit
    end tell
    I can't figure out exactly how to put the delay into this. Do I need an if/then conditional?

    Here:
    display dialog "Currensys Alert" buttons {"OK"} giving up after 1--time in seconds
    (50598)

Maybe you are looking for

  • How can i reset an ipad with icloud that i dont have a password to? iOS7

    My Dad bought an iPad 2 from a pawn shop and didnt check it because it was on the set up screen. When he gave it to me as a gift i went through the usial set up process but when i got to the icloud set up screen it asks for a password to someone else

  • Partition an Advanced Format drive with 4KB sector (for Linux OS only)

    I got a brand new WD 1TB drive, model WD10EZEX, I'm upgrading from an old 500 GB drive with Arch running on it, and I'm going to make a fresh Arch install on it. I suddenly learned about all this Advanced Format issue, with the first units "lying" ab

  • Payments transactions in t-code FK02

    Hi, I would like to allow only one user to change the payment transactions in provider master data but i want to allow all the other users to change data like the address and the name Ca i achieve my goal? How can i do that?                          

  • IDOC for Payment Proposal

    Hello, Does anyone know of a standard IDOC I can use that produces a Payment Proposal?  I would prefer that the proposal is by sorted by vendor and due date with total amount for the vendor due date combination. Thanks

  • Meeting Place Directories service question

    I have just deployed a new Meeting Place 8.0 with LDAP integration. I have created the LDAP in CCM, and also create the directory services in Meeting Place. However, when I checked the option "Update Now", it returns with the error "Directory Service