• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to empty clipboard contents?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to empty clipboard contents?


  • Subject: Re: how to empty clipboard contents?
  • From: Deivy Petrescu <email@hidden>
  • Date: Mon, 22 Mar 2004 20:13:08 -0500

At 7:06 PM -0500 3/22/04, Michael Bovee wrote:
Thanks for the help so far! Your suggestions will really improve my script. But before getting into that below, I still would like to know if its possible to talk to the finder about the state of the clipboard? Maybe not necessary for this script, but down the road.


One way to do what you want the way you want is written below. I have to say that I believe Paul's method is better.
Activating and copying might make the script slower.
But it is your decision.
This is inside an Excel tell block

<script>
repeat with i from startfile to thefilerange
OpenText "MacOS X:Users:username:" & workingfile & "." & i --opening many files
set lastLine to Row of (LastCell of Range "c1" Direction xlDown)--finding last line of a column
set theRange to "R1C1:R" & lastLine & "C4" -- defining the range of values
Select Range theRange --selecting the range
CopyObject Selection --copying selection
Activate Window theFile --theFile is your Master file
set lastLine to Row of (LastCell of Range "c1" Direction xlDown)-- selecting the last line of the Master
set theRange to "R" & (lastLine + 1) & "C1"
Select Range theRange --selecting the first empty cell after all the others.
Paste -- paste
CopyObject Selection-- copying the recent paste from Master files
Activate Window (workingfile & "." & i) -- not realy needed
Close ActiveWindow saving No -- because I've selected the range in the new file, it will close without asking me anything...
end repeat



Because ultimately I want a script that will copy selections from _many_ .txt files (which can be opened directly in Excel) into one final Excel file. I havent sorted out yet which part(s) of the process will be "looped" so in my first attempt, I visualized a solution that began with saving what would become the master list Excel file first, and then having some recursive loop that opens succesive text files from someDirectory and copy/pasting the relevant part back into the master file...


Check the script above.



Close Window "03195052.TXT"
Activate Window "FILENAME.xls"

-- is that necessary?

Probably not. I'm just trying to visually work through how I'll eventually switch back and forth between each newly opened .txt file and the Master file. Its difficult for me even to decipher some of the examples in Matt Neuberg's book, which really jumps in assuming a _lot_ of prior programming experience, IMHO. But I'll get there.

I partly agree with you Michael, as you are learning see more of the script and how it works.
After you are more familiar with it, listen to Paul, streamline it.

Thanks again Paul and Walter, for sharing your insights!
--Michael


By the way Walter, to copy a formula in excel use the following:

set f to FormulaR1C1 of Cell "R1C1" -- to get it in f
or
set Value of Cell "R1C2" to FormulaR1C1 of Cell "R1C1"-- to copy it to another cell.

--
Regards
Saudagues

Deivy
http://www.dicas.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: how to empty clipboard contents? (From: Michael Bovee <email@hidden>)

  • Prev by Date: Re: how to empty clipboard contents?
  • Next by Date: Re: how to empty clipboard contents?
  • Previous by thread: Re: how to empty clipboard contents?
  • Next by thread: Re: how to empty clipboard contents?
  • Index(es):
    • Date
    • Thread