f



Create IE object in .vbs file, and control the javascript tinymce editor in the page

In a standalone .vbs file, I create an ie object and navigate to a
page containing a javascript tinymce editor. Now I want to get/set the
content of the tinymce editor. Is it possible to do that?

P.S. Can javacript be run as standalone application, just like
the .vbs file?

Thanks! Any help will be appreciated!
0
12/8/2009 5:09:54 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

5 Replies
483 Views

Similar Articles

[PageSpeed] 10

On Dec 8, 11:09=A0am, Zhiguo <zhiguoyo...@gmail.com> wrote:
> In a standalone .vbs file, I create an ie object and navigate to a
> page containing a javascript tinymce editor. Now I want to get/set the
> content of the tinymce editor. Is it possible to do that?

The IE object should be the window object if it was created with
CreateObject("InternetExplorer.Application")
Use the DOM

Ref:
http://msdn.microsoft.com/en-us/library/aa752084%28VS.85%29.aspx

> P.S. Can javacript be run as standalone application, just like
> the .vbs file?

yes, make sure it points to cscript.exe or wcript.exe
0
Michael
12/8/2009 6:15:32 PM
Thanks a lot for your reply and help!
But the most difficult part is how to retrieve the content of tinyMCE
editor.
As far as I know(I am not sure), the content of the tinyMCE editor
cannot be get direcly by refering to the DOM object.
It need to be done by some javavript.
But the problem is, I am using vbscript creating the IE object.
I don't know how to call the javacript function in a page which is in
an IE object created by vbscript.
Looking forward to your reply!
Thanks again!

Here is my code:

'-----------------------------------------------------------
Set IE=3D CreateObject("InternetExplorer.Application")
IE.Visible =3D True
IE.Navigate("./NewEntry.do")
Do While IE.Busy Or (IE.ReadyState <> 4)
    Wscript.Sleep 500
Loop
' NewEntry.do contains a tinyMCE editor

IE.document.forms("editorForm").title.value=3D"world"

IE.document.tinyMCE.get("editor").value=3D"hello"
'This sentence does not work

IE.document.forms("editorForm").submit()


On Dec 9, 2:15=A0am, "Michael Haufe (\"TNO\")"
<t...@thenewobjective.com> wrote:
> On Dec 8, 11:09=A0am, Zhiguo <zhiguoyo...@gmail.com> wrote:
>
> > In a standalone .vbs file, I create an ie object and navigate to a
> > page containing a javascript tinymce editor. Now I want to get/set the
> > content of the tinymce editor. Is it possible to do that?
>
> The IE object should be the window object if it was created with
> CreateObject("InternetExplorer.Application")
> Use the DOM
>
> Ref:http://msdn.microsoft.com/en-us/library/aa752084%28VS.85%29.aspx
>
> > P.S. Can javacript be run as standalone application, just like
> > the .vbs file?
>
> yes, make sure it points to cscript.exe or wcript.exe

0
Zhiguo
12/8/2009 6:33:58 PM
On Dec 8, 12:33=A0pm, Zhiguo <zhiguoyo...@gmail.com> wrote:
 > ...

Judging by your example I think your probably trying to solve the
wrong problem by treating the window as some sort of proxy to
ultimately do something else. This discussion would be better answered
at a VBS focused site such as visualbasicscript.com or the vbs usenet
group.
0
Michael
12/8/2009 7:37:20 PM
Zhiguo wrote:

> As far as I know(I am not sure), the content of the tinyMCE editor
> cannot be get direcly by refering to the DOM object.

You are mistaken; doubly so because the script you are accessing it with 
runs in a privileged environment and so the Same Origin Policy does not 
matter.

> It need to be done by some javavript.

Why?

> But the problem is, I am using vbscript creating the IE object.

So do not use it, use JScript instead.  The filename suffix should be .js 
and .js files should be associated with one of the mentioned executables.

> I don't know how to call the javacript function in a page which is in
> an IE object created by vbscript.

It is rather irrelevant in which language the script is written that you 
access the JScript function in the document with, as long as the Windows 
Script Host supports that language.

Do not top-post.  <http://jibbering.com/faq/#posting>


PointedEars
-- 
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
0
Thomas
12/8/2009 8:08:02 PM
Many thanks to all of you!

On Dec 9, 4:08=A0am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
> Zhiguo wrote:
> > As far as I know(I am not sure), the content of the tinyMCE editor
> > cannot be get direcly by refering to the DOM object.
>
> You are mistaken; doubly so because the script you are accessing it with
> runs in a privileged environment and so the Same Origin Policy does not
> matter.
>
> > It need to be done by some javavript.
>
> Why?
>
> > But the problem is, I am using vbscript creating the IE object.
>
> So do not use it, use JScript instead. =A0The filename suffix should be .=
js
> and .js files should be associated with one of the mentioned executables.
>
> > I don't know how to call the javacript function in a page which is in
> > an IE object created by vbscript.
>
> It is rather irrelevant in which language the script is written that you
> access the JScript function in the document with, as long as the Windows
> Script Host supports that language.
>
> Do not top-post. =A0<http://jibbering.com/faq/#posting>
>
> PointedEars
> --
> Use any version of Microsoft Frontpage to create your site.
> (This won't prevent people from viewing your source, but no one
> will want to steal it.)
> =A0 -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-co=
mp.)

0
Zhiguo
12/10/2009 2:29:09 AM
Reply: