save specifier : the object for the command
[
as text] :
The file type in which to save the data.[in alias] : The file in which to save the object.
As you may see as and well are described as optional.
I don't know which is the string supposed to define the file type.
When I asked info for to gave the value it returned ""
When I asked "System Events" it returned missing value.
So I tried with :
tell application "Safari"
save document 1 as "webarchive"
end tell
--> error "You can only specify a file format when you also specify a file in which to save the document." number -1715
The error message make me think to use the optional in parameter with the script :
set p2d to path to desktop as text
tell application "Safari"
name of document 1
save document 1 as "webarchive" in (p2d & result & ".webarchive")
end tell
and got the error :
—> error "The document cannot be saved in the \"webarchive\" format." number -50
As I am pig headed, I thought that if the error message returned by the first attempt may be read as : specify a file in which to save is sufficient.
So I tested an other code and posted :
set p2d to path to desktop as text
tell application "Safari"
name of document 1
save document 1 in (p2d & result & ".webarchive")
end tell
does the job
Now that the technical aspect is answered, I wish to add some words.
When I write:
does the job
it's because I took time to run the script before posting.
So, the next time, before responding to such a message,
run the script before writing something like :
If this works, that's odd and sorta scary
Maybe it's due to the fact that English is not my true language, but from my point of view, it was insulting.
Yvan KOENIG (VALLAURIS, France) mercredi 15 janvier 2014 17:57:59