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.
Similar Messages
-
Applescript: display dialog / saving to . . .
The following script always has the document folder selected in the "save as" window
How do I designate another locaiton such as the desktop
or even create a folderat the desk top and have it selected as the save to
(G5 PPC OS X 10.5.8 Applescript)
Thank you
say (text returned of (display dialog ¬
"Enter what you would like synthesized into a file." default answer ¬
"Welcome to Mac OS X.")) saving to (choose file name with prompt ¬
"Choose where you would like to to save the file." default name "say.aiff")The choose file / defaul location is a reference to a folder which is useful
But how do I change the locaiton from the documents folder to the desktop
The desktop is not a folder and won't work with this comand
I googled and come up with a solution:
say (text returned of (display dialog ¬
"Enter what you would like synthesized into a file." default answer ¬
"Welcome to Mac OS X.")) saving to (choose file name with prompt ¬
"Choose where you would like to to save the file." default name "say.aiff" default location path to desktop)
Thanks for pointing me in the right direction -
Applescript: display dialog until memory card is inserted
I'm developing an applet to automate the process of copying video footage from my camera's memory cards onto my hard drive. It works perfectly, except that I cannot quit it. Here is the part of the code that needs help. It checks every 5 seconds for a memory card and, if one is inserted, continues to copy everything off it.
repeat
set cardIn to 1
with timeout of 86400 seconds
tell application "Finder"
repeat while cardIn is 1
if exists disk "EOS_DIGITAL" then
set cardIn to 0
else
delay 5
end if
end repeat
end tell
end timeout
(the rest of the code)
end repeat
The problem is that there is no way I can find to quit once it is in this wait loop. The menu command to quit and the Command-Q hotkey both do nothing so I have to force quit when done. What I'd like is to be able to have a dialog displayed asking this user if they want to quit while it's waiting, but I don't know how to do that without it having to "give up after 5 seconds". That makes a new dialog display again every 5 seconds when it rechecks for memory cards, which would get very annoying for anyone using the computer.
I wish something like this would work...
repeat until (list disks) contains "EOS_DIGITAL"
display dialog "Waiting for card..." buttons {"Quit"}
tell me to quit
end repeat
...but it still waits for a button to be clicked in the dialog. I want this to be a truly automatic process, where plugging in a memory card triggers the whole copy process (which is already done and works perfectly) so I would rather not have to click a button to continue.
Is there any way to have a dialog displayes with a quit button that automatically goes away once a memory card is inserted without using "giving up after x seconds"?Keeping a script or application locked up inside delays or repeat loops will keep it from responding to system events. There are a few ways to monitor when a volume gets mounted:
Write your application using AppleScript in Xcode to watch for a workspace notification;
Use launchd or a folder action to watch the /Volumes folder (an alias is added to the folder when a volume is mounted);
Make your script into a stay-open application and use an idle handler to periodically check. -
AppleScript Display dialog if clause
What I'm trying to do now is have a pop up trigger from a calendar event(already know that part) and ask a user if they are ready to launch another workflow. If they select NO I want there to be a 5 minute delay and then have the same question asked again. I cant figure out how to loop the original question back through and I know there has to be a way to do it.
Heres my code so far...
set question to display dialog "If you're ready to clock in, punch for lunch, or clock out click YES. If you are stuck on a chat cancel this bad boy." buttons {"No", "Yes"} default button 2
set answer to button returned of question
if answer is equal to "Yes" then
tell application "Finder" to activate
tell application "System Events"
keystroke "c" using {command down, control down, option down}
end tell
end if
if answer is equal to "No" then
display dialog "Automator will snooze for 5 minutes" buttons {"Snooze", "Snooze"} default button 2
delay 300
display dialog question
end if
Thanks in advanced for any input!You can also just put the whole thing in another repeat statement:
repeat -- forever
set answer to button returned of (display dialog "If you're ready to clock in, punch for lunch, or clock out click YES. If you are stuck on a chat cancel this bad boy." buttons {"No", "Yes"} default button 2)
if answer is equal to "Yes" then
tell application "Finder" to activate
tell application "System Events"
keystroke "c" using {command down, control down, option down}
end tell
exit repeat
else
display dialog "Automator will snooze for 5 minutes" buttons {"Snooze"} default button 1 giving up after 10
delay 300
end if
end repeat -
Applescript: display dialog while doing shell script
Hello there,
I'm making an applescript app for my company, and had a question.
The functionallity of the app is working great, but there is a certain step which can take up to several minutes.
This can give the user the feeling that nothing is happening and things are stuck.
Is there a possibility to display a dialog as long as the action (shell script) is running?
Something along the lines of "Now performing action X. please wait...)
Thanks for your thoughts!
GrtzWith regular AppleScript you can start the shell script in the background (see do shell script in AppleScript) and then put up a dialog, although you would have to periodically check to see if the shell script is finished. In Lion, the AppleScript Editor has a Cocoa-AppleScript template that you can use (kind of a wrapper application that lets you use various Cocoa methods without having to use Xcode), in which case you could put up an indeterminite progress indicator and then do the shell script.
AppleScript Studio is deprecated as of Snow Leopard, but there are some AppleScriptObjC in Xcode tutorials at MacScripter. An additional source of information and templates is macosxautomation, but they seem to be having some server problems at this time. I also have a Progress Window template application example, it can be downloaded here. -
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.
--TIAThe 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. -
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
RegardsNo 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 & 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.
-
Using the 'Display Dialog command with default answer "" returns two results; Button pressed and text.
I want to isolate the text to use in an application. Does anybody know the syntax to allow me to do this. until upgrade to Mavericks the text appears to have been the default return, now its the button.
ThanksFor those of you who may be experiencing the same problem I have manged to resolve the issue with the following lines:
Set mvar to (display dialog "add data" default answer "")
set mvar to text returned of mvar
This leave mvar with the text only to be used in an application etc, in my case numbers.
refer to page 161 of the Applescript Language Guide -
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. -
Display dialog w/ applescript and xcode why so different
Hi all
Having an issue with a dialog box in xcode
In AS editor I have a long dialog box but xcode only shows half the message
display dialog "line 1
line 2
line 3
line 4
line 5
line 6
line 7"
For some reason applescript shows the whole message where as xcode only shows the first 2 lines and cuts off the rest.
Why is that?
How can I fix this?
I need to display no less then 7 lines in the dialogNever mind I figured it out
tell app "finder"
activate
tell app "system events" to display dialog "1
2
3
4
5
6
7
end tell
---- -
Font rendering issue / Mountain Lion / non Apple LCD display
Hello
This font rendering issue or problem is probably well know by Apple crew too but nobody has solved it yet. Only poor solution are available such as try to adjust manually font rendering by writin some scripts concerning anti alias levels...they really dont solve the problem.
Could Apple bring us solution to this by developing or updating Mountain Lion?
So what is the problem: font rendering is very poor in Mountain Lion when using non Apple LCD. For example Fujitsu SL27T-1 LED (LCD displa) shows fonts very nice way in Windows but in Mac OS ML does not. Somebody told me that its about software vs. hardware rendering. Dont know about that but could you bring me the solution which is not advising me to buy Apple display (which is five times more expensive than other manufactures displays).
Br
M. Leinojust want to add that overall fonts look blurry and they are not very sharp.
-
Display Dialog with Hidden Answer
Now Im trying to use a hidden answer dialog to get a password and pass it to the next step in my Automator Application. The code I have so far is:
on run {input, parameters}
set theScript to input
tell me to activate
display dialog "What is your password?" default answer "" with hidden answer
set ACP to text returned of result
set keychaincan to input & ACP
return keychaincan as string
end run
I know this works without the hidden answer, and I cannot see why its failing with "with hidden answer" at the end.
I get the automator error "Syntax Error. Expected end of line, etc. But found identifier."
Any ideas?Automator has its own variation of several things such as display dialog - you can see the terminology provided by looking at Automator's scripting dictionary. The Automator version of display dialog doesn't have a hidden answer parameter, so one workaround is to use something like System Events, which will wind up using the regular StandardAdditions version:
tell application "System Events" to display dialog "What is your password?" default answer "" with hidden answer -
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.
-DavidHi 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. -
Page 741 Step # 12 : editEmployee.jsff 's dialog remains opened / rendered
I am using JDeveloper 11.1.1.5.
This post is regarding "Oracle JDeveloper Handbook",
Chapter 20 subsection entitled "Fix The Popup Behavior",
page 741, Step # 12...
Running templateTest.jspx displays all the records... I can scroll through all of them.
Then step 12, when I click the tuhraTrainTemplate.jspx 's "Finish" button,
the editEmployee.jsff 's popup does indeed close.
HOWEVER, the editEmployee.jsff 's dialog remains opened / rendered.
This dialog is a child of the popup.
This dialog's Title is "Manage Employee Images".
This dialog is supposed to close according to step # 12.
SOMEWHAT RELATED (and background) INFORMATION:
I tried reproducing the (above) dialog problem by downloading www.tuhra.com 's C20-II.zip
(since the problem cited above is very near the end of Chapter 20 section 2).
The C20-II.zip templateTest.jspx runs on my JDeveloper 11.1.1.5 and renders.
HOWEVER, no records are displayed (and no anomalies / exceptions appear in the integrated weblogic log window).
On a positive note, clicking the "Manage Images" command link produces the
popup and clicking the "Finish" button closes both the popup and the dialog.
For C20-I.zip, templateTest.jspx runs on my JDeveloper 11.1.1.5 and renders.
HOWEVER, no records are displayed (and no anomalies / exceptions appear in the integrated weblogic log window).
If others are also seeing no records displayed, that could be useful information (but a different issue).
For C19-V.zip, templateTest.jspx runs on my JDeveloper 11.1.1.5 and renders...
AND the records are displayed and I can scroll through all of them... all seems well.
NOTE:
Since I started "Developing Developing The Sample Application" on page 567,
I have been using Oracle Database 11g Express the whole time.
When peaking at www.tuhra.com downloadable applications (available after each section),
I just remove the existing DB connection and create a new one for " XE ", express edition.
Edited by: 818167 on Jul 17, 2011 6:05 PMSolved:
1. Type chflags nohidden ~/Library/ in a Terminal window.
2. Click on the hard drive icon located on the desktop.
3. Go to Users > [username] > Library > Safari folder.
4. Delete all files except “Bookmarks.plist”.
5. Then go to Users > [username] > Library > Preferences.
6. Find com.apple.Safari.plist, com.apple.internetconfigpriv.plist, and com.apple.internetconfig.plist and delete them (ignore any file you can’t find).
Maybe you are looking for
-
My wife and I have our own apple accounts (for our iphones) but share (or fight really!) over the only iPad. Is it possible to download Apps from both our accounts onto the Ipad, or would this violate the T&C and so not possible? Any thoughts most we
-
How to rectify the payable account not definderror in down payment request
how to rectify the payable account not definderror in down payment request
-
IBooks Author crashes every 30 seconds: h264 encoder?
I am using iBooks Author 2.1.1 on Mavericks. The program is crashing like every 30 seconds for no apparent reason (specific actions, that is). I cannot see the <edited by host> problem reporter anymore . This is what it offers all the time stating s
-
CD/DVD drive reading games as blank cd
I am using HP Pavillion series, P6823W, Product QN642 AA#ABA with OS Win7. I often play games using dvds and until now have had no problems. Tonight when I tried to use it, the message that came up asked me what I wantd to do with the blank cd/dvd.
-
Can Time Machine be used to backup BootCamp?
I wish to use my Time Machine to backup Bootcamp. But is that of any use? My purpose is not just to backup the data. I wish to have the OS to be backed up also. So that upon restore the entire OS should be present as it was during the Last TM Backup.