On Jan 15, 2014, at 12:06 PM, koenig.yvan wrote: Le 15/01/2014 à 17:10, Alex Zavatone < email@hidden> a écrit : On Jan 15, 2014, at 11:00 AM, koenig.yvan wrote: 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
If this works, that's odd and sorta scary that just specifying the file name determines the type of file you are saving as.
Why would it be odd ?
The dictionary claims :
save v : Save an object. 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.
Because the as specifier is not used at all in the code you suggested.
If the optional specifiers are not supplied, then how are we to assume how Safari will set the file type of the document will be saved? It would be just guesswork on our part.
OHHHHHHHHHHH.
I was looking at your save line, where as is not specified. It never occurred to me that the as parameter would be included in the path variable above. Since as is a verb in English, it translates to me as a command/function, not a parameter signifier.
This is one area where AppleScript's English-like syntax can add confusion.
But still, you're specifying to save it as text, not as a webarchive. Then you're calling the file a .webarchive.
This is certainly confusing.
I would expect that you would save the file as the type of webarchive and in a file with the extension .webarchive, not as the type of text.
But, if this works, it works and thanks for the time you put into helping the original poster out.
Cheers Yvan. - Alex |