Closing TextEdit window issue

(*Generally, this script appears to do everything I want except . . . if TextEdit is already launched when the script is run, then the "saving no" added to the close command (at end of script, below) is ignored. If TextEdit is not already launched when the script is run, then the "saving no" is honored. Ideas? There's also a less important question at line 5.*)
set T to "Please read these instructions . . ."
set LAUNCHstatus to ""
set _WsTE to ""
try
set LAUNCHstatus to do shell script "lsof / | grep TextEdit.app" --(>>faster way for single app?)
end try
try
set _WsTE to windows of application "TextEdit"
end try
tell application "TextEdit"
if LAUNCHstatus is not "" and _WsTE is not "" then make new document
activate
set name of front window to "INSTRUCTIONS"
set _WsTE to windows of application "TextEdit"
set _WTE to item 1 of _WsTE
--set _pWTE to properties of _WTE
set bounds of front window to {50, 200, 800, 500}
set text of front document to T
tell the text of the front document
set size to 14
set the color of every character to {87563, 5274, 8493}
end tell
tell application "System Events"
keystroke "r" using command down
end tell
display dialog "Have you read the instructions yet?" buttons {"Yes", "No"}
if button returned of result is "Yes" then
beep 1
else
beep 3
end if
end tell
tell application "TextEdit"
close _WTE saving no --<<IF SCRIPT IS STARTED WITH TextEdit not launched, this works correctly. BUT IF SCRIPT IS STARTED WITH TextEdit launched, there is a prompt for a save.
end tell

Hi kel,
The "set was_running" clause you substituted is certainly a more effiecient (faster) way of determining launch status.
And your script certainly seems to solve the "close saving no" issue (although I still don't understand why the original script does this).
Turns out there is still another issue that I hadn't detected (occurs with both my original script and your script):
If when the script is run TextEdit is already launched and has pre-existing documents which have been hidden (hidden, not minimized), then upon running the script all of those hidden documents are brought to the desktop. True, they go back into hiding when "d" is closed, but they're a bit of a distraction.
Not quite sure how "Hide" works, but it's some kind of batch process as all
hidden documents are represented by a single icon in the dock.
I'll look at this and maybe you have some ideas as well.
Thanks, osimp

Similar Messages

  • Why does captivate hang when it is closed in window 8.1 professional ? How is it solved?

    Why does captivate hang when it is closed in window 8.1 professional ? How is it solved?

    Hi,
    Do you see the issue every time you close captivate or is it only in some scenarios? Does it show any error messages? What captivate version are you using (64 bit or 32 bit)? Can you provide some more information or screenshots which can help us reproduce the issue.
    Tamish

  • When closing Firefox windows, I would like a warning before the last window closes. The about:config settings do nothing. There is a warning for multiple tabs..

    When closing Firefox windows, I would like a warning before the last window closes. The about:config settings do nothing. There is a warning for multiple tabs... why not for the last window? I do not use tabs... just windows... I have a mouse button programmed for that. It is really irritating to have to restart Firefox all the time and then open the history window because no warning was issued!

    This is ridiculous. I've had this problems for years now and I'm finally walking away from Firefox. I use my keyboards more than my mouse, and how many times does your finger slip and hit Command Q instead of W. How come FF can't reset something as trivial as this? So many people are having problems with this?
    Feels like FF has become too big, too slow and just not cooperative anymore. What a shame, I've been using Netscape/Firefox for 13 years. This is silly.

  • Preview and TextEdit windows continuously lose focus

    Preview and TextEdit windows keep losing focus.
    In other words, I select the window, but them moments later it deselects itself (title and traffic light buttons grey out).
    The app's menu is still visible (ie it still appears as if Preview or TextEdit is the active app).
    But if I do single-app-expose, no windows appear at all and I just see a blank screen (ie as if the app doesn't have any windows open at all).
    So it's almost as if the app isn't aware it even has windows open?
    Anyone else have this? Any ideas for a fix?

    I'm not sure of the name or if it is even accessable from system monitor.  I had the same issue with the daemon relanching the app and ended up uninstalling everything until there is a fix.  I believe the last update is from 2009 so it's not in active development and chances of an expedited fix aren't great.  I wrote an email to axiotron the same day as my oruginal post here and have not received a response yet. 
    While a complete uninstall is more of a trade off than a solution it may be the only 'fix' for the time being.  To uninstall you may need to run an app from within the installation dvd or disk image. 
    I'm not near my mac right now but will double check some things in a bit and post if I discover anything new and useful.  In the mean time you can check for options within your app that may disablethe  autostart feature.  This doesn't exist in Quickscripts so I was forced to either uninstall or deal with the bug and not use textedit and preview.....I chose to uninstall of course.

  • On closing Acrobat Windows detect an error "Data Execution Prevention has closed Adobe Acrobat".

    Hi,
    I developed a plugin which captures Before/After open, close and save events and perform some operation inside these events.
    I tested the plugin in Windows XP and Acrobat 9.0.0 and 10.0.0 and everything works fine. But when in test my plugin on Windows Server 2008 Standard 32 bits, then windows detect an error while closing the acrobat and shows the following message:
    "Data Execution Prevention has closed Adobe Acrobat"
    I am using Acrobat 10.0.0 for testing in Windows Server 2008 operating system. Also, debugging the program shows no error but plugin does not produce the desired result when tested on Windows Server 2008 Standard 32 bits operating system.
    Can anyone please giude me how to resolve this issue??
    Thanks in advance!

    Are you really using 10.0.0?  You've installed no updates to it??
    From: poortip87 <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Mon, 6 Feb 2012 21:46:02 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: On closing Acrobat Windows detect an error "Data Execution Prevention has closed Adobe Acrobat".
    On closing Acrobat Windows detect an error "Data Execution Prevention has closed Adobe Acrobat".
    created by poortip87<http://forums.adobe.com/people/poortip87> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4190399#4190399

  • Closed Project Window Stays Open

    I have one project out of three where this is a problem.  I can end the project but the window does not close.
    I am using Captivate 4 and I have gone to preferences and changed end of project to be Close Project. Even at that, the last slide wants to keep going. I want it to freeze so it can be read. I put a button on it to stop the slide and then had to put a dummy slide at the back to close the project once the viewer hits the Close button.
    On the other projects, I can just let the slide fade out. Why does the window stay open? Is there a solution? I could not find this listed in the forum but was sure this was an issue in versions 2 and 3 as well.
    Thanks.
    Jeffrey Riley

    Do you mean like this?
    Indeed, that is the new behaviour. You have to make a selection, before closing the window.
    The new GarageBand does not quit, when closing the main application window. This way you faster switch between projects. You do not have to quit and relaunch.
    If you want GarageBand to quit, use the quit command ⌘Q instead of closing the main window.
    -- Léonie

  • Trigger Javascript when closing browser window from CP8

    I worry this isn't possible but here goes....any help would be incredible.
    Recently I was given some great advice on how to trigger a Javascript action in the frame on our LMS which the Captivate file plays in.
    It works perfectly and on the final page triggers the Javascript which send usage back to the LMS and forward the user to a page which allows them to rate the course.
    The code was as follows:
    top.code.closeSCOContent();
    closeSCOContent() is something written into our LMS.
    However the obvious issue occurs when a user just closes the browser window and for some reason our LMS doesn't record any bookmarking or any data.
    The only way it seems to do this is if that function is called.
    So using the window.onunload() or the DOFinish; function is there a way I can edit any file in the Captivate output to trigger this function when closing the browser?
    Long shot I know but currently the best I have managed is getting the course to trigger this as soon as it loads rather than closing the window?
    Massive thanks in advance for any advice.

    Any solution to ensure the data is written back to the LMS would solve the issue.
    Currently when the close button is pressed nothing happens at all and it's a big problem.
    Triggering this .closeSCOContent() function would be the ideal, but if it's not possible anything to write back would be best.
    When you say <body onbeforeunload="top.code.closeSCOContent();">
    Do you mean putting this in the HTML file of the output which currently is:
    <body bgcolor="#f2f2f2">
    and change this to:
    <body onbeforeunload="top.code.closeSCOContent();" body bgcolor="#f2f2f2">

  • Java.exe has generated errors and will be closed by windows

    We are running win2000, with jre 1.4 and getting the following message at a particular point in our program:
    <b>"java.exe has generated errors and will be closed by windows. You will need to restart the program. An error log is being created."</b>
    I have 2 questions:
    1) does anyone know what would cause this?
    2) does anyone know where this log file is generated to?
    many thanks - there are a few duke dollars in it.

    We are getting same error with jdk1.6,
    we can get drwtsn32.log file for user home/documents folder by running with following option. -XX:+ShowMessageBoxOnError
    We got following log message:
    Application exception occurred:
    App: (pid=2288)
    When: 2/5/2008 @ 18:20:44.700
    Exception number: c0000005 (access violation)
    ----> System Information <----
    Computer Name: MAX-20
    User Name: Suresh.A
    Number of Processors: 1
    Processor Type: x86 Family 15 Model 2 Stepping 9
    Windows 2000 Version: 5.0
    Current Build: 2195
    Service Pack: 4
    Current Type: Uniprocessor Free
    Registered Organization: maxem
    Registered Owner: max-20
    has anybody found any solution / tools to identify this kind of issue?
    Thanks
    Nimalan

  • Backend BSP session not closing on server after closing the window

    Hi All,
    We have SAP EP (7.0 SP21) and there is a BSP transaction ivew (Interaction Center ) intergrated in the portal. The issue is when the user performs any transactions inside the BSP and then closes the browser, session remains on the server till the timeout. Is there a way to end those sessions on server after closing the browser immediately?
    Portal domain : xx.mycomp.com
    ABAP system domain :mycom.com
    Should the domains be same for the DSM of Portal to work or is there any solution that can be considered.
    regards
    Uday

    Hi Uday,
    These are the main issues that can cause issues with DSM:
    JavaScript Origin Policy:
    Scripting
    between different domains is not allowed because of “JavaScript origin policy”.
    Also
    communication between mixed protocols (http\https) is forbidden.
    Therefore
    the portal server and the content server must be on the same domain and must
    use the same protocol.
    For
    detailed explanation see:
    http://mozilla.org/projects/security/components/same-origin.html
    Popup Blocker:
    •Popup blockers may cause troubles
    in relation with SRA feature.
    •Terminator handles notifications in
    new window when current window is being destroyed (logoff, closing browser
    window) – popup blocker prevents the opening of new window, hence no session
    handling performed.
    please also check SAP Note #596698 for more information typical problems and troubleshooting.
    In general, the 2 domains should be the same.
    xxx.mycomp.com, meaning that first part of the url can change but what comes after should be the same domain.
    Best regards,
    Etay

  • ITunes has generated errors and will be closed by windows

    I just bought an iPod and downloaded iTunes, however now when I try to open iTunes, I keep getting a message that says "iTunes.exe has generated errors and will be closed by windows, you may need to restart the program" HELP!!! I don't know what to do!!! I've tried removing the program and reinstalling it several times. I've updated my windows program and also made sure I have updated spyware. I don't know what else to do. If I can't fix it soon, I'm going to return the dumb thing!!!

    Hi Kuxster,
    Try this, and see if it does anything (there's probably a different root to your issue, but you might want to go ahead and give this a try).
    1 - Remove all <b<iTunesSetup.exe</b> installers off your computer. (You might want to search for them: "START > Search", type in "itunessetup", and hit the Return key.)
    2 - Now, download another copy of iTunes from this page: Download iTunes - 7.2.0.35
    3 - After you have fully installed iTunes, restart your computer.
    Now, when you attempt to launch iTunes. Do you still get that error message?
    If you still are having issues, then I can call in one of our iTunes experts to troubleshoot this one.
    -Kylene

  • Closed Captioning Window slow to open

    We have a team member using CP7 on a Win7 machine having a delay when he opens the closed captioning window.  It can take up to 10 seconds for the window to open. 
    We just put him on someone elses machine and it didn't do that even when logged in with his credentials.  He says it has done that through all the versions of Captivate that he's used on the XP and Win7 platforms and on previous computers.
    Does anyone have an idea of what might be causing this?
    Thank you,
    Susan

    Here's the fix to which I was referring, supplied by a colleague on Linked-In:
    "There are 2 instances of a codec that need to be turned into a .bak file.
    First you go into C/program files/Adobe Media Encoder CS5/MediaIO/codecs to find a file "SurCodeWrapper.vca" Change it to "SurCodeWrapper.vca.bak" do the same thing in C/program files/AdobePremiereProCS5/MediaIO/codecs with the "SurCodeWrapper.vca file there too. This WILL fix the lag. I think you lose surround sound encoding by doing this, but this hasn't been a problem for me."

  • When I close and reopen firefox, it restores my tabs, but it restores tabs from hours or days ago, not the ones that were open when I closed the window - why?

    I normally keep my Firefox window open for long periods of time because I have a lot of active tabs. When I close the window and reopen it, I am still able to restore tabs, but as of a few weeks ago, it has stopped restoring the most recent version. Normally, when I would close and reopen, the tabs would be the same ones that were open when I closed the window. Now, it restores to a version from a few days ago instead of the current version. I have to revert to pulling my more recent tabs out of the recent history. I checked my options and I can't figure out any way to control this. How can I fix it so that I can count on my Firefox window to restore the tabs that I actually care about?

    You can check for problems with the sessionstore.js and sessionstore.bak files in the Firefox Profile Folder that store session data.
    Delete the sessionstore.js file and possible sessionstore-##.js files with a number and sessionstore.bak in the Firefox Profile Folder.
    *Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Deleting sessionstore.js will cause App Tabs and Tab Groups and open and closed (undo) tabs to get lost, so you will have to create them again (make a note or bookmark them).
    *http://kb.mozillazine.org/Multiple_profile_files_created
    *http://kb.mozillazine.org/Session_Restore

  • How do I move a group of tabs before closing a window?

    I recently lost all my custom settings on Firefox after an aggressive tech support person "cleaned" my browser settings. When this happened, I lost the ability to move my open tabs to a new group before closing the window they were in.
    Previously, when I had multiple windows open, and I initiated an "Exit" or "Close" command on one of the open windows, 2 things happened:
    (1) First I received a warning message asking me if I wanted to close the window
    (2) Then I received a second warning message asking me if I wanted to move my tabs before closing the window.
    Now, I only receive the 1st message, and I am no longer offered the option of moving my tabs to a new window before closing the current window.
    I've tested this both with and without the Tabs Group Manager which I was using prior to the time my browser was "cleaned", and I still have not found a way to restore this missing feature.
    Unfortunately, I don't know if this feature/option is:
    -- provided as a default in Firefox
    -- a customizable feature in Firefox, or
    -- a feature in a Firefox add-on.
    Can anyone tell me where/how to restore this option to move a group of tabs before closing a window?
    Thanks,
    Metta

    Thank you, guigs2, for your feedback, and my apologies for the confusion. After rereading my question, I realize I made a couple of typos in my original help request which cannot now be corrected. Specifically, the 2nd sentence in the first paragraph should have read:
    "I lost the ability to move GROUPS of open tabs to a new WINDOW before closing the window they were in."
    This means that, as far as I can tell, neither of your plugin recommendations applies:
    -- Apparently, Tab Mix Plus only applies to manipulating tabs WITHIN the existing window and, unless I am missing something, I did not see any reference to the option I'm looking for -- specifically, an automatic prompt offering to move groups of tabs to a new window before closing the existing window.
    -- Unfortunately, the other plugin you mentioned (Tag Cloud) appears to be non-functional in the current version of Firefox, based on the most recent user reviews.
    In light of this, I will consider the possibility of resubmitting my question with the typos corrected -- and, in the meantime, if there is any additional feedback that you (or anyone else) can offer, I would be most grateful!

  • Acrobat.exe closed by Windows & "invalid annotation object"

    While I am editing comments with Acrobat 9.3.1, I get a Windows error "acrobat.exe ..... closed by Windows"
    Then when I open the PDF document, I get "invalid annotation object" error, and the file is corrupted and not usable any more.
    Please advise me what steps I need to take to this frequent errors on my computer.  Thanks.

    I too had a Multi Page PDF that had the same "invalid annotation object".
    I was able to open & use the damaged  using Tracker Software - PDF Viewer - PDFXCview (free software - Google it)
    The file opened without error in PDFXCview and I was able to save it, but reopen in Acrobat still had the error.
    I re-opened it in PDFXCview and deleated the comments on the page that Acrobat reported the "invalid annotation object", and was able to save the file, which now opens in Acrobat without the error.

  • Opening an image file in an existing TextEdit window

    I'm blocked on this, which seems it should be straightforward (but maybe it isn't).
    If I have an open TextEdit window on the desktop and drag an image file to it, the image appears in the window.
    How do I replicate that result with AS?

    Hi red_menace
    Your proposed approach seems reasonable, although I haven't tried it. Rather, I'm looking at other ways of achieving the present goal. That is to open a small window on the desktop with an embedded image and embedded text -- and then, at certain dates (not a problem), move the window to a different position, perhaps with a different image and different text.
    A TextEdit window certainly wasn't ideal for this, as it has baggage I can do without -- a ruler (which can be eliminated with a system events command), a title, and the three manipulation buttons.
    A window that would better meet my needs would be a "Stickies" window, but Stickies isn't scriptable.
    I can move it around fine with Finder commands, and I can close it. If I create all the windows I will need ahead of time (there are a limited number), I don't know whether it's possible to bring them up selectively -- I don't even know where/how the files are stored; I've looked at the package contents and don't find them there. I'm talking about the files for Stickies window that appear when Stickies is launched.
    The only other app I've found with a fairly basic window layout is Core Image Fun House.app, which also isn't scriptable -- but maybe I can get a bead on its stored files.
    Or maybe there are other choices . . . ?
    I'd welcome suggestions but in the meantime will just keep playing around with it. This is not the most urgent matter in the world!
    osimp

Maybe you are looking for