• 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: Autosave Numbers document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autosave Numbers document


  • Subject: Re: Autosave Numbers document
  • From: "koenig.yvan" <email@hidden>
  • Date: Fri, 12 Sep 2014 20:49:20 +0200

Hello

My code may be enhanced.

During my first tests, I created the pathname in the main code.
It issued an error claiming that I had no rights to do that.
So I wrote the handler asking System Events to create a file.
In fact it was useless. What is needed is just to build the pathname out of the tell application "Numbers" block.

So you may use :



tell application "Numbers"
repeat
set theFiles to file of every document
--> {file "<myHD>:Users:<myAccount>:Desktop:truc.numbers", missing value, missing value}
if theFiles does not contain missing value then exit repeat
repeat with i from 1 to count theFiles
if item i of theFiles is missing value then
save document i in file (my createAfile())
delay 1 # to be sure to use a different name
exit repeat
end if
end repeat
end repeat
end tell

#=====

on createAfile()
set p2d to path to desktop as text
set newName to my horodateur(current date) & ".numbers"
return p2d & newName
end createAfile

#=====

on horodateur(une_date)
tell une_date to return (((its year) * 10000 + (its month) * 100 + (its day)) as text) & "_" & text 2 thru -1 of ((1000000 + (its hours) * 10000 + (its minutes) * 100 + (its seconds)) as text)
end horodateur

#=====



Yvan KOENIG (VALLAURIS, France) vendredi 12 septembre 2014 20:48:50


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Autosave Numbers document (From: okn <email@hidden>)
 >Re: Autosave Numbers document (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: Autosave Numbers document
  • Next by Date: Open BBEdit Recent Items
  • Previous by thread: Re: Autosave Numbers document
  • Next by thread: Re: Autosave Numbers document
  • Index(es):
    • Date
    • Thread