Multithreaded Display Dialog?

I'm believe this must have been asked before.  Forgive me for doing it again.  But, my searching has only found very old discussions on it.
Is there a way, using Applescript Editor, to display information to a user and not stop the script from running.  Display dialog and display alert both pause the script while waiting for the user.
I'm confident I could do it in XCode.  But, I'm not ready to take on the efforts in mastering that just for this one application.
Thank you very much!

Regular AppleScript doesn't have anything but those modal dialogs, so you would have to use a separate application or something else such as AppleScriptObjC or RubyCocoa.  Starting in OS X 10.7 Lion, the AppleScript Editor has a Cocoa-AppleScript Applet template that will create an application where you can use Cocoa stuff via AppleScriptObjC without the need for Xcode - without using the Interface Editor though, you will need to create UI objects manually.
I have a Cocoa-AppleScript template/example that uses a controller script with a few support handlers to create and use a message window with a scrolling text view that is not modal, if you want to take a look at that - it can be downloaded here.

Similar Messages

  • How do I use Display Dialog to get back a date?

    Can anyone tell me how to use Display Dialog to get back a date?
    I am using the following code that does not work. It does not accept anything.  And I have searched high and low for an answer to my question and found nothing.
    repeat
           display dialog "When should I remind you (date)?" default answer ""
           try
                 if the text returned of the result is not "" then
                        set the requested_text to the date returned of the result as date
                        exit repeat
                end if
           on error
               beep
    end try
    endrepeat
    display dialog requested_text
    The code is based on what I found in AppleScript 1-2-3 (page 300). It shows examples for getting text and numbers but not one for dates.
    For what it is worth, my goal is to create a script that will convert an email from Evernote into an iCal Reminder. To do so, I want to ask the user (myself) for the reminder's date and time. I am assuming I need to ask for each separately. I also assume that once I get the date and time for the reminder, it should be relatively straightforward to 'make' a 'todo' with an alarm.
    Thanks in advance.
    -David

    Hi David,
    Try this:
    repeat
        set theCurrentDate to current date
        display dialog "When should I remind you (date)?" default answer (date string of theCurrentDate & space & time string of theCurrentDate)
        set theText to text returned of result
        try
            if theText is not "" then
                set theDate to date theText -- a date object
                exit repeat
            end if
        on error
            beep
        end try
    end repeat
    display dialog (date string of theDate & space & time string of theDate)
    You might also have a look at this page of the AppleScript Language Guide.
    Message was edited by: Pierre L.

  • 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

  • Applescript Display Dialog Default Answer Rendering Issue

    After I installed Lion, I started having issues with Applescript rendering a dialog with a textbox.
    This is the sort of thing I end up seeing:
    The text box in the dialog doesn't render properly, and it's not possible to enter anything into it.  I've played with the display dialog parameters but it doesn't matter if I give an empty string for the default answer or other text, the behaviour is always the same.
    Does anyone have any ideas as to what the issue might be?  I suspect I might need to reinstall Lion, but I'm not sure that's even going to clear up the issue.
    Thanks in advance.

    Tried replacing 'Standard Additions' osax, dumping editor prefs, dumping ALL user prefs (not recommended for faint of heart), using a different copy of Script Editor. Nothing helped.
    The user account displaying the bug is an old one; likely updated continuosly from the days of Tiger or earlier.
    A std account on the same drive, which merely went through the Snow Leopard -> Lion transition, does not exhibit the edit-text display bug.
    So I bit the bullet, and used Migration Assistant to move to a new account on a clean install of Lion on a spare hard drive. 3.5 hours later, the Applescript edit text display bug is gone.
    As far as I can tell, all docs, Apps etc. made it through intact.
    If that continues to look true over the next few days, I'll try using SuperDuper! to copy the new drive back to the older, faster HD.
    Perhaps some other Lion bugs'll also go away now that I've got a cleaner install.

  • 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

  • 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.

  • How to don't display dialog after send data?

    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

    I have moved this thread to the BPC NW forum.  Notice the sticky [note|Please do not post BPC, SSM or FI/CO questions here!; at the top of the FPM - General (PCM, FC, Other) Forum whereby we announced new dedicated forums for BPC which are the proper place to post your questions regarding BPC in the future.
    [Jeffrey Holdeman|http://wiki.sdn.sap.com/wiki/display/profile/Jeffrey+Holdeman]
    SAP Labs, LLC
    BusinessObjects Division
    Americas Applications Regional Implementation Group (RIG)

  • 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.

  • How can a remotely launched Applecsript display dialog?

    I have many Mac-computers running a variety of Mac OS X systems, including Tiger, Leopard, and Snow Leopard. On Tiger and Leopard, a Terminal bash-script could launch a compiled and saved Applescript (in /Applications/myLogout.app), which uses "say" to tell the user the system is going down in two-minutes. It then waits (delay 120), and then uses "say" again with this message, "System going down in 10 seconds". That's followed by a "display dialog" with the same message. The User could "Cancel" to stop the execution of the Applescript. If not, the applicaton proceeds to do cleanup work, like eliminating pesky /var/tmp files that invariablely end up as "Recovered" files or folders, and then it does "shut down".
    I could remote login from another computer and execute this simple bash-script:
        #!/bin/bash
        if [ -x "/Applications/myLogout.app" ] ; then
           osascript /Applications/myLogout.app display >/dev/null 2>&1"
        else
           echo "Can't find Logout application"
        fi
        exit 0
    This bash-script would wait at the osascript command until the Applescript terminated, which it did either because someone clicked Cancel in the dialog, or the "shut down" command occurred. My session then regained control, and usually was quickly terminated as a remote session.
    But now, Snow Leopard wouldn't properly execute the Applescript. It always fails for lack of a WindowServer connection to my remote session.
    I can't use launchd for this because of similar restrictions. For one thing, I have no clue who might be the active user on the target computer, and never had to worry about that because the "display dialog" was always presented to the "current" user. So, basically, Apple has removed the capability that existed in both Tiger and Leopard. Furthermore, their "solution" of using launchd doesn't cover this scenerio: - - remote launch of a UI application that warns the "current user", does a lot of cleanup work, and shuts down the computer.
    I can do everything in a bash shell except present a dialog to give the "current user" a chance to Cancel. Basically, the myLogout application can be launched by the "current user", and since it doesn't have an input parameter, it doesn't wait or do the dialog. That works. But even when called from a bash-script WITHOUT a parameter (that's the "display" word in the sample), it still fails in Snow Leopard.
    One final note: The "Product" listed with this post is NOT my Snow Leopard system, but it's NOT 10.4.11 either. I'm on 10.5.8

    One of us is confused about something, and I'm not sure which of us it is.
    What message are you trying to pass? If you want a formulaic "Shutdown in two minutes" message then code it directly into the script and don't bother with passing it. If you want a custom message that might change on different runs, then the easiest solution is to call a handler of the application on the remote machine and pass the message as a parameter.  just for an example, do this:
    Put this script as a stay-open script application on the remote machine:
    global idleInterval, message
    on idle
              try
      -- error catching. when you call handler x(), first the script's run handler will run, then the idle handler, then x(), and the the idle handler in a loop. this prevents unset variable errors on the first pass.
      message
      idleInterval
              on error errstr
                        return 1
              end try
              if idleInterval is "Start" then
      say message
                        set idleInterval to 10
              else if idleInterval is 10 then
      say message
                        set idleInterval to 5
              else
                        display dialog "System wants to shut down"
                        set idleInterval to 1
                        quit
              end if
              return idleInterval
    end idle
    on x(textMessage)
              set idleInterval to "Start"
              set message to textMessage
    end x
    go back to the admin machine and run this command in the applescript editor:
    tell application "ShowMsg" of machine remoteMachine
              x("Whoohoo!")
    end tell
    If it asks for authorization, give it. You can either save it in your keychain or we can work through the auth problem next.

  • 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.

  • Multiline display dialog + font style control?

    I have an Applescript application I'm building in Xcode that needs to present multiple lines of information in a sheet. For some reason, I'm only able to get three lines -- how do I get a sheet to display more than three lines?
    Current code:
    display dialog myVariableContainingMuchoLines attached to window of myWindow
    Also, I'd like to format the result -- is it possible to control the text size and font in dialog boxes?
    Thanks!

    You don't have any formatting options when using 'display dialog'. It's meant as a simple, one-line, easy-to-use command.
    If you want something more sophisticated then you need to create your own window. Since you're already in XCode this is pretty easy - just use Interface Builder to create your dialog and show it like you would any other window.

  • 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)

  • Display dialog, await user input how to get no timeout?

    I have a script i run on login, it brings up a dialog that requests user input, how can I stop it timing out if nothing happens?

    Sorry long delay to get back to my question that I asked,
    Still having issues, original I used the timeout action, and that keeps the script working.... However it still times out and then when I use the
    giving up after 150
    I've not tested it to see if it prevents an early timeout, but clicking a the dialog and my script, just stops working there and does nothing else.
    --These files need to change on boot.
    --:Applications:Adobe Photoshop CS6:Presets:Scripts:SAVEAS.jsx
    --:Applications:Adobe Photoshop CS6:Presets:Scripts:SaveOnly.jsx
    --:Volumes:StudioC:Users:StudioC:Workflow:Folder Actions:0_HeliconHotFolder.scpt
    set CS6Applications to ((path to applications folder as text) & "Adobe Photoshop CS6:Presets:Scripts")
    set HeliconLabeler to ((path to home folder as text) & "Workflow:Folder Actions")
    set HeliconAbdul to ((path to me as text) & "Contents:Resources:Scripts:abdul:0_HeliconHotFolder.scpt")
    set HeliconMatt to ((path to me as text) & "Contents:Resources:Scripts:matt:0_HeliconHotFolder.scpt")
    set HeliconShah to ((path to me as text) & "Contents:Resources:Scripts:shah:0_HeliconHotFolder.scpt")
    set PS6SaveAsAbdul to ((path to me as text) & "Contents:Resources:Scripts:abdul:SAVEAS.jsx")
    set PS6SaveOnlyAbdul to ((path to me as text) & "Contents:Resources:Scripts:abdul:SaveOnly.jsx")
    set PS6SaveAsMatt to ((path to me as text) & "Contents:Resources:Scripts:matt:SAVEAS.jsx")
    set PS6SaveOnlyMatt to ((path to me as text) & "Contents:Resources:Scripts:matt:SaveOnly.jsx")
    set PS6SaveAsShah to ((path to me as text) & "Contents:Resources:Scripts:shah:SAVEAS.jsx")
    set PS6SaveOnlyShah to ((path to me as text) & "Contents:Resources:Scripts:shah:SaveOnly.jsx")
    tell application "System Events"
              if name of current user is equal to "StudioA" then ¬
                        set MacName to "true"
              if name of current user is not equal to "StudioA" then ¬
                        set MacName to "false"
    end tell
    with timeout of (60 * 61) seconds
              display dialog "Who is using the Computer?" buttons {"Abdul", "Matt", "Shah"} with icon caution
              if result = {button returned:"Abdul"} then
                        if MacName = "true" then
                                  tell application "Finder"
      duplicate file PS6SaveAsAbdul to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyAbdul to folder CS6Applications with replacing
                                  end tell
                        else if MacName = "false" then
                                  tell application "Finder"
      duplicate file HeliconAbdul to folder HeliconLabeler with replacing
      duplicate file PS6SaveAsAbdul to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyAbdul to folder CS6Applications with replacing
                                  end tell
                                  display alert "Turn Camera on"
                                  delay 1
                                  tell application id "breezesys.com.dslrremotepro" to activate
                                  menu_click({"DSLRRemotePro", "Camera", "Set date/time and owner string..."})
                                  delay 1
                                  tell application "System Events"
      keystroke "a" using command down
                                            delay 1.5
                                            keystroke "Shot_By_Abdul"
                                            delay 1.5
      keystroke return
                                  end tell
                        end if
              else if result = {button returned:"Matt"} then
                        if MacName = "true" then
                                  tell application "Finder"
      duplicate file PS6SaveAsMatt to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyMatt to folder CS6Applications with replacing
                                  end tell
                        else if MacName = "false" then
                                  tell application "Finder"
      duplicate file HeliconMatt to folder HeliconLabeler with replacing
      duplicate file PS6SaveAsMatt to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyMatt to folder CS6Applications with replacing
                                  end tell
                                  display alert "Turn Camera on"
                                  delay 1
                                  tell application id "breezesys.com.dslrremotepro" to activate
                                  menu_click({"DSLRRemotePro", "Camera", "Set date/time and owner string..."})
                                  delay 1
                                  tell application "System Events"
      keystroke "a" using command down
                                            delay 1.5
                                            keystroke "Shot_By_Matt
                                            delay 1.5
      keystroke return
                                  end tell
                        end if
              else if result = {button returned:"Shah"} then
                        if MacName = "true" then
                                  tell application "Finder"
      duplicate file PS6SaveAsShah to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyShah to folder CS6Applications with replacing
                                  end tell
                        else if MacName = "false" then
                                  tell application "Finder"
      duplicate file HeliconShah to folder HeliconLabeler with replacing
      duplicate file PS6SaveAsShah to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyShah to folder CS6Applications with replacing
                                  end tell
                                  display alert "Turn Camera on"
                                  delay 1
                                  tell application id "breezesys.com.dslrremotepro" to activate
                                  menu_click({"DSLRRemotePro", "Camera", "Set date/time and owner string..."})
                                  delay 1
                                  tell application "System Events"
      keystroke "a" using command down
                                            delay 1.5
                                            keystroke "Shot_By_Shah"
                                            delay 1.5
      keystroke return
                                  end tell
                        end if
              end if
    end timeout
    --handlers
    on menu_click(mList)
              local appName, topMenu, r
      -- Validate our input
              if mList's length < 3 then error "Menu list is not long enough"
      -- Set these variables for clarity and brevity later on
              set {appName, topMenu} to (items 1 through 2 of mList)
              set r to (items 3 through (mList's length) of mList)
      -- This overly-long line calls the menu_recurse function with
      -- two arguments: r, and a reference to the top-level menu
              tell application "System Events" to my menu_click_recurse(r, ((process appName)'s ¬
                        (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
    end menu_click
    on menu_click_recurse(mList, parentObject)
              local f, r
      -- `f` = first item, `r` = rest of items
              set f to item 1 of mList
              if mList's length > 1 then set r to (items 2 through (mList's length) of mList)
      -- either actually click the menu item, or recurse again
              tell application "System Events"
                        if mList's length is 1 then
      click parentObject's menu item f
                        else
                                  my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
                        end if
              end tell
    end menu_click_recurse

Maybe you are looking for