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

Z

Zhiguo

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!
 
M

Michael Haufe (\TNO\)

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(VS.85).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
 
Z

Zhiguo

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= CreateObject("InternetExplorer.Application")
IE.Visible = 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="world"

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

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

Michael Haufe (\TNO\)


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.
 
T

Thomas 'PointedEars' Lahn

Zhiguo said:
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
 
Z

Zhiguo

Many thanks to all of you!

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.


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.


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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top