• 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: Omar K N <email@hidden>
  • Date: Sat, 13 Sep 2014 00:10:07 +0200

Thank you Ivan,

An autosave from the OSX is only saving when quitting the app or exiting the OS, or not?

Otherwise an autosave could not be observed here, yet.

save document i in file (my createAfile())
delay 1 # to be sure to use a different name

I don’t think a file needs to be created, it’s always for already named files (should have said that!).
Excuse me, but for what should i "use a different name.”

/
with best regards,
Omar K N
Stockholm, Sweden



Message: 3
Date: Fri, 12 Sep 2014 20:49:20 +0200
From: "koenig.yvan" <email@hidden>
To: liste AppleScript US <email@hidden>
Subject: Re: Autosave Numbers document
…
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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20140912/2d2b08eb/attachment.html>

------------------------------

_______________________________________________
AppleScript-Users mailing list
email@hidden
https://lists.apple.com/mailman/listinfo/applescript-users

End of AppleScript-Users Digest, Vol 11, Issue 337
**************************************************

 _______________________________________________
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

  • Follow-Ups:
    • Re: Autosave Numbers document
      • From: "koenig.yvan" <email@hidden>
  • Prev by Date: Open BBEdit Recent Items
  • Next by Date: Re: Autosave Numbers document
  • Previous by thread: Re: Autosave Numbers document
  • Next by thread: Re: Autosave Numbers document
  • Index(es):
    • Date
    • Thread