 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
VibrantLife
Joined: 29 Oct 2009 Posts: 47
|
Posted: Sun Nov 22, 2009 3:03 am Post subject: COM javascript question element focus |
|
|
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... |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2428
|
|
| Back to top |
|
 |
VibrantLife
Joined: 29 Oct 2009 Posts: 47
|
Posted: Sun Nov 22, 2009 3:16 pm Post subject: |
|
|
| sinkfaze wrote: | You're close:
| Code: | | COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus") |
|
Alright 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... |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2294 Location: Louisville KY USA
|
|
| Back to top |
|
 |
VibrantLife
Joined: 29 Oct 2009 Posts: 47
|
Posted: Sun Nov 22, 2009 4:36 pm Post subject: |
|
|
| 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:
The COM object may not be a valid dispatch Object! _________________ The signature is away at the moment, please leave a message after the beep... |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2428
|
Posted: Sun Nov 22, 2009 4:42 pm Post subject: |
|
|
| VibrantLife wrote: | But gives the same error:
The COM object may not be a valid dispatch Object! |
What is the exact error message(s)? _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
VibrantLife
Joined: 29 Oct 2009 Posts: 47
|
Posted: Sun Nov 22, 2009 5:00 pm Post subject: |
|
|
| sinkfaze wrote: | | VibrantLife wrote: | But gives the same error:
The COM object may not be a valid dispatch Object! |
What is the exact error message(s)? |
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... |
|
| Back to top |
|
 |
VibrantLife
Joined: 29 Oct 2009 Posts: 47
|
Posted: Sun Nov 22, 2009 6:39 pm Post subject: |
|
|
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... |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2294 Location: Louisville KY USA
|
|
| Back to top |
|
 |
VibrantLife
Joined: 29 Oct 2009 Posts: 47
|
Posted: Sun Nov 22, 2009 7:39 pm Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|