Can Save as dialogue box be called from javascript? 
Author Message
 Can Save as dialogue box be called from javascript?

I am trying to find a method of auto saving (a bit like word processors do)

1. Can javascript be used to display the Save as dialogue box (rather than
the brower)
2. Is it possible to use javascript to prefill the input fields and accept



Wed, 18 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?

Quote:
> I am trying to find a method of auto saving (a bit like word processors
do)

> 1. Can javascript be used to display the Save as dialogue box (rather than
> the brower)

document.execCommand('SaveAs')

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/exe...
d.asp

Quote:
> 2. Is it possible to use javascript to prefill the input fields and accept

document.yourForm.fieldName.value = 'something'
document.yourForm.submit()

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/sub...

--
Thor Larholm



Thu, 19 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?

Quote:

> > 2. Is it possible to use javascript to prefill the input fields and
accept

> document.yourForm.fieldName.value = 'something'
> document.yourForm.submit()

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/sub...

Many thanks for very useful reply

The second part of the query however referred to the fields of the Save As
dialogue box e.g. setting the file path,etc by javascript presumably via
document.execCommand('Saveas') parameters??



Fri, 20 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?

Quote:

> > > 2. Is it possible to use javascript to prefill the input fields and
> accept

> > document.yourForm.fieldName.value = 'something'
> > document.yourForm.submit()

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/sub...

Quote:

> Many thanks for very useful reply

> The second part of the query however referred to the fields of the Save As
> dialogue box e.g. setting the file path,etc by javascript presumably via
> document.execCommand('Saveas') parameters??

I'm sorry, but this is a no-go (security feature).

You can use Windows Scripting Host to save the documents automatically from
within javascript, but your user will always have to accept the execution of
this.

--
Thor Larholm



Fri, 20 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?

Quote:
> > The second part of the query however referred to the fields of the Save
As
> > dialogue box e.g. setting the file path,etc by javascript presumably via
> > document.execCommand('Saveas') parameters??

> I'm sorry, but this is a no-go (security feature).

> You can use Windows Scripting Host to save the documents automatically
from
> within javascript, but your user will always have to accept the execution
of
> this.

I was playing around and it DOES appear that the syntax supports the setting
of the file name as the first input field within the dialogue box.

var x =document.execCommand('Saveas',false,'ho.htm',0,0,true);

or

var x =document.execCommand('Saveas',false,'ho.txt',1,0,true);

PS. I am a little unsure of the implications of  Vvalue  as a variant - does
it mean that all the operands can be passed as an ordered string?

PPs While highly unlikely, if true then it would be possible to silently
install just about any file or any type on any Windows PC !!!



Fri, 20 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?
Do you want to invoke the "Save as..." browser dialog to save the page or do
you just need a generic "Save as..." dialog?


Quote:
> I am trying to find a method of auto saving (a bit like word processors
do)

> 1. Can javascript be used to display the Save as dialogue box (rather than
> the brower)
> 2. Is it possible to use javascript to prefill the input fields and accept



Fri, 20 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?


Quote:
> Do you want to invoke the "Save as..." browser dialog to save the page or
do
> you just need a generic "Save as..." dialog?

The previous thread answers my basic query (although this is MS specific).

For example var x =document.execCommand('Saveas',false,'ho.htm',0,0,true);

I would like to know if Netscape and other browsers have equvialent system
commands?



Fri, 20 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?

Quote:
> The previous thread answers my basic query (although this is MS specific).

> For example var x =document.execCommand('Saveas',false,'ho.htm',0,0,true);

Then I guess you wanted the browser's "Save As" ;)

Quote:
> I would like to know if Netscape and other browsers have equvialent system
> commands?

NS4 has nothing like IE5's automation. I don't know about NS6 (maybe XPCOM
would let you do what you can do in IE with COM).


Sat, 21 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?
many thanks

Did you see my question in the previous thread regarding vValue as a variant
when using execCommand method?

a) I am trying to find out whether it is possible to prefill all of the
Saveas dialogue box input fields (not just the first field ) from javascript
(vValue is a variant of input values as ordered string?). I have tried the
following but only the file name/file type operand is accepted.

         var x =document.execCommand('Saveas',false,'filename.htm',0,0,true,
'this.click()');

b) Does vValue (execCommand) allow the specification of a click event (the
eqivalent of clicking the Save button on the dialogue box). or is there a
way of creating a click event for the current page from within javascript.



Sun, 22 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?

Quote:
> many thanks

> Did you see my question in the previous thread regarding vValue as a
variant
> when using execCommand method?

> a) I am trying to find out whether it is possible to prefill all of the
> Saveas dialogue box input fields (not just the first field ) from
javascript
> (vValue is a variant of input values as ordered string?). I have tried the
> following but only the file name/file type operand is accepted.

>          var x

=document.execCommand('Saveas',false,'filename.htm',0,0,true,

Quote:
> 'this.click()');

> b) Does vValue (execCommand) allow the specification of a click event (the
> eqivalent of clicking the Save button on the dialogue box). or is there a
> way of creating a click event for the current page from within javascript.

a&b:

You can prefill the input field, but not force a click on the OK button.

If you want to force files onto the users computer, utilize one of the many
exploits found in IE, which means illegal hacking, or use Windows Scripting
Host, which means the user must accept your request.

--
Thor Larholm



Sun, 22 Dec 2002 03:00:00 GMT  
 Can Save as dialogue box be called from javascript?

Quote:
> b) Does vValue (execCommand) allow the specification of a click event (the
> eqivalent of clicking the Save button on the dialogue box). or is there a
> way of creating a click event for the current page from within javascript.

This kind of automation would be a serious security risk, so it is not
allowed as far as I know. You might however install an invisible ActiveX
control to do it, but the user must permit it to be installed.


Sun, 22 Dec 2002 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. save dialogue box

2. WSH Script to save a web page as a text file - dialogue box problem

3. Calling the Save As dialog box from script.

4. Save and Open File Dialogues?

5. Forcing file save as dialogue

6. how to display a dialogue box?

7. javascript array problem, or am I just stupid!!!

8. I am new to javascript and have a question

9. Opening the save diablog box instead of openig the file

10. File Open/Save Box

11. "Save as..." dialog box in script

12. save as msg box

 

 
Powered by phpBB® Forum Software