AutoHotkey Community

It is currently May 27th, 2012, 2:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: November 22nd, 2009, 4:03 am 
Offline

Joined: October 29th, 2009, 10:03 pm
Posts: 50
Hello,

When i put this into the addressbar and press Enter
Code:
javascript:function ChangeColor(){document.body.style.background="yellow"};ChangeColor();

The background changed into Yellow.

But when i put this:
Code:
javascript: alert(document.forms[0].elements[0].value)
MsgBox % COM_Invoke(pwb, "document.forms[0].elements[0].value")

Nothing happens.

I really like to learn more about Com and javascript.
Because it seems quite powerfull.

I have a question about focus on to an inputbox

I lookup the inputbox with Webrecorder:

on Text of element
is:
Code:
[value]=
<INPUT style="WIDTH: 300px" id=ctl00_K_H_MA_FA_IA_achterNaamEdit class=clsTextBox maxLength=40 name=ctl00$K$H$MA$FA$IA$a

and on iWeb function:

Code:
msgbox % iWeb_getDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit")
iWeb_clickDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit")
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", "")


What kind of code i need to focus first to this Inputbox after loaded?

Like?:

Code:
javascript: document.all.ctl00_K_H_MA_FA_IA_achterNaamEdit.focus()
COM_Invoke(pwb, "document.all.ctl00_K_H_MA_FA_IA_achterNaamEdit.focus")


How can i incorporate this into a existent ahk script,
to test this?

Thanx!

_________________
The signature is away at the moment, please leave a message after the beep...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 5:53 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
You're close:

Code:
COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus")

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 4:16 pm 
Offline

Joined: October 29th, 2009, 10:03 pm
Posts: 50
sinkfaze wrote:
You're close:

Code:
COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus")


Alright :D this works

Code:
#include COM.ahk
#include iweb.ahk
#z::
WinWait, Invoeren persoon - Windows Internet Explorer,
IfWinNotActive, Invoeren persoon - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
WinWaitActive, Invoeren persoon - Windows Internet Explorer,

COM_Init()
pwb:=iWeb_getwin("test.htm")
COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus")
COM_Term()
return



Is there a way to set iWeb_getwin to the Title name like?:
iWeb_getwin("Invoeren persoon - Windows Internet Explorer")

Because when i now do it like:

Code:
#include COM.ahk
#include iweb.ahk
#z::
WinWait, Invoeren persoon - Windows Internet Explorer,
IfWinNotActive, Invoeren persoon - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
WinWaitActive, Invoeren persoon - Windows Internet Explorer,

COM_Init()
pwb:=iWeb_getwin("Invoeren persoon - Windows Internet Explorer")
COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus")
COM_Term()
return


I get a error like:
The COM object may not be a valid dispatch Object!

_________________
The signature is away at the moment, please leave a message after the beep...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 5:26 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
omit the suffix
- Windows Internet Explorer

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 5:36 pm 
Offline

Joined: October 29th, 2009, 10:03 pm
Posts: 50
tank wrote:
omit the suffix
- Windows Internet Explorer


Hi,

I tried that:

Code:
#include COM.ahk
#include iweb.ahk
#z::
WinWait, Invoeren persoon - Windows Internet Explorer,
IfWinNotActive, Invoeren persoon - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
WinWaitActive, Invoeren persoon - Windows Internet Explorer,

COM_Init()
pwb:=iWeb_getwin("Invoeren persoon")
COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus")
COM_Term()
return


But gives the same error:
:arrow: The COM object may not be a valid dispatch Object!

_________________
The signature is away at the moment, please leave a message after the beep...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 5:42 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
VibrantLife wrote:
But gives the same error:
:arrow: The COM object may not be a valid dispatch Object!


What is the exact error message(s)?

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 6:00 pm 
Offline

Joined: October 29th, 2009, 10:03 pm
Posts: 50
sinkfaze wrote:
VibrantLife wrote:
But gives the same error:
:arrow: The COM object may not be a valid dispatch Object!


What is the exact error message(s)?


Image

With webrecorder i searched for: Invoeren persoon
and it says:
[innertext]=Invoeren persoon

Could that be the issue¿

_________________
The signature is away at the moment, please leave a message after the beep...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 7:39 pm 
Offline

Joined: October 29th, 2009, 10:03 pm
Posts: 50
Never mind the titlename i just use the urlname instead its ok.

I tried to give the inputbox the value of the clipboard like:

Code:
#include COM.ahk
#include iweb.ahk
COM_CoInitialize()
WinWait, Invoeren persoon - Windows Internet Explorer,
IfWinNotActive, Invoeren persoon - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
WinWaitActive, Invoeren persoon - Windows Internet Explorer,


pwb:=iWeb_getwin("test.htm")
sleep 500

COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus"),
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", "%clipboard%")
; this isn't work all to good either: jscript = javascript: document.getElementById("ctl00_K_H_MA_FA_IA_achterNaamEdit").value="%clipboard%";
COM_Release(objIE)
COM_Term()
return


But it send literally: %clipboard% instead of the clipboard content haha
omg i'm a real noobie.

_________________
The signature is away at the moment, please leave a message after the beep...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 8:03 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Code:
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", clipboard)

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 8:39 pm 
Offline

Joined: October 29th, 2009, 10:03 pm
Posts: 50
tank wrote:
Code:
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", clipboard)


Ah thanks!!

_________________
The signature is away at the moment, please leave a message after the beep...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, Google [Bot], rbrtryn and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group