Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: how to empty clipboard contents?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to empty clipboard contents?

I want to close the first Excel file. At this point a prompt box in Excel pops up asking if I care
about all the data on the Clipboard.

A quick Test here, using 'Excel X for Mac, Version 10.0., showed that a total selection and copying of 50 Cells or less will not result with the "There is a large amount of information on the Clipboard." Dialog Box, when a respective Excel Worksheet is closed.

I dont know how to tell excel to respond to this and clear the box, so instead it just has my script in a headlock.

I cannot see how to set Excel's Clipboard to empty - Excel's Dictionary indicates that its Clipboard is read only; but, you can remove ...

tell application "Finder"
empty "clipboard"
end tell

... from your Code, and then add ...

Activate Window "03195052.TXT" -- optional Line.
Select Range "R1C1" -- You can select any 'RXCY' Cell, where X and Y are valid Range Values.
CopyObject Selection

... just prior to 'Close Window "03195052.TXT"'. This copies a single Cell's Value to Excel's Clipboard. This single Cell Value selection will not activate the "There is a large amount of information on the Clipboard." Dialog Box.

It seems I could work around this if I could tell the Finder to empty the clipboard contents, before I have Excel close the window that I'm finished with.

No, Excel's 'Clipboard' is not the same as the Mac OS'es - System [Global] 'Clipboard'. Besides, when you execute 'Close Window "03195052.TXT' the selected and copied Contents are in Excel's Clipboard; not yet in the System's 'Clipboard'.

So, how can I talk to the finder about the clipboard? I cant find a dictionary entry that seems to work with the clipboard...

The System's Clipboard, visibly accessed by the 'Finder's 'Edit > Show Clipboard' Menu Item, is scriptable via the 'Standard Additions' 'Clipboard Commands' of 'clipboard info', 'set the clipboard to', and 'the clipboard'.

If you also want to empty the System's Clipboard from within your 'tell application "Excel" ... end tell', just add 'set the clipboard to ""'. It may be best to insert this Line of Code just prior to the very last 'end tell'.


applescript-users mailing list | email@hidden
Do not post admin requests to the list. They will be ignored.

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.