 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Sun Jul 06, 2008 12:47 am Post subject: |
|
|
| tank wrote: | these are on a corp domain without roaming profiles but the registry and policies move with user
if a different user logs in on the pc where the script does not work for that other user the script works |
I agree with Joy2DWorld, it could be a problem of setting/policy of the user, however, difficult to tell definitely without seeing the code and error report. Didn't COM.ahk produce any error message? If so, I suspect it failed at the stage of creating objects. You may try again after changing the following line in COM_Error() | Code: | | If (sName="" ? bDebug:=hr : !bDebug)||!hr | to | Code: | | If (sName="" ? bDebug:=hr : !bDebug) |
The actual error message in this case (:hr="") doesn't matter, and it might produce a lot of message boxes so better be warned. |
|
| Back to top |
|
 |
erictheturtle
Joined: 27 Jun 2007 Posts: 58 Location: California
|
Posted: Sun Jul 06, 2008 7:00 pm Post subject: |
|
|
Hi Sean. Great job keeping the COM stdlib maintained and helping everyone with it.
I've run into a memory leak that affects both the COM stdlib and ws4ahk. This simple script will demonstrate it.
| Code: | #include COM.ahk
Msgbox % "Starting. Check memory"
Loop, 9000
{
COM_ScriptControl("")
}
Msgbox % "Finished. Check memory" |
When the first message is shown, AHK is using under 4MB of memory. Once it gets started, it will fluctuate around 4.5MB and 5.5MB. But over time this will increase to over 6MB. When the final message is shown, the process is left with using over 6MB of memory.
I broke the script down into one large block of code here.
I've tried the following:
* just initializing/deinitalizing COM thousands of time
* creating/deleting the Script Control object thousands of times
* setting the scripting language thousands of times
None of these seem to cause the leak.
It seems only the combination of the following steps lead to the leak:
1) Initialize COM
2) Create the Scripting Control object
3) Set the scripting language
4) Delete the object
5) Uninitialize COM
I don't see anything wrong with our scripts. Any idea on why this could be happening? _________________ -m35 |
|
| Back to top |
|
 |
rani
Joined: 18 Mar 2008 Posts: 59
|
Posted: Sun Jul 06, 2008 9:43 pm Post subject: run javascript function by invoke |
|
|
Hi sean and others,
I tried the library CoHelper
and with Invoke commands I succeed to run from javascript:
- open new object documnet after navigate
- to execute the methods getElementById
and others methods.
but I didn't succeed to just run some function (defined in <script> section
of the HTML <head>.
something like:
Invoke(objWin,"MyFunction",param1)
the function didn't run.
so :
what is the object in Invoke to run the function ?
or I can run it directly without an object ?
any help will be appreciated.
rgrds
Ell |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 422 Location: Galil, Israel
|
Posted: Sun Jul 06, 2008 11:03 pm Post subject: |
|
|
| erictheturtle wrote: |
4) Delete the object
|
How specifically you doing that ?
EDIT:
or...
they've lowered the per-byte charge for posting,
so now you can go ahead and post the *ACTUAL CODE* of the test you (and everyone) used.... so... can ... compare... if IS ACTUALLY SAME TEST! _________________ Joyce Jamce
Last edited by Joy2DWorld on Mon Jul 07, 2008 12:23 pm; edited 1 time in total |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Sun Jul 06, 2008 11:49 pm Post subject: |
|
|
| erictheturtle wrote: | | When the first message is shown, AHK is using under 4MB of memory. Once it gets started, it will fluctuate around 4.5MB and 5.5MB. But over time this will increase to over 6MB. When the final message is shown, the process is left with using over 6MB of memory. |
It doesn't happen in my test, both scripts end with 4.3MB or 4.5MB memory.
I tested in (English) XPSP3 Professional and AHK 1.0.47.06. And,
msscript.ocx: Version 1.0.0.16599, Size 110592 bytes, CRC32 DD498D5E. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Sun Jul 06, 2008 11:55 pm Post subject: Re: run javascript function by invoke |
|
|
| ell wrote: | | Invoke(objWin,"MyFunction",param1) |
It could be possibly PropertyPut, in that case you have to append suffix = to the function name with CoHelper.ahk
| ell wrote: | | Invoke(objWin,"MyFunction=",param1) |
I recommend COM.ahk over CoHelper.ahk as CoHelper.ahk is no longer maintained and you can omit the suffix = even in case of PropertyPut with COM.ahk. |
|
| Back to top |
|
 |
rani
Joined: 18 Mar 2008 Posts: 59
|
Posted: Mon Jul 07, 2008 3:54 am Post subject: javascript function from AHK |
|
|
in javascript function runs as subroutine
in my case I ask on just subroutine run,
no return values.
so in Invoke:
1. what I put in the object ?
why invoke is not execute the JS function ?
any syntext code will help
I need sample code in COM.ahk or CoHelper:
IE object Instance
Navigate
getting Document Object Instance
and run JS function
rgrds
Ell |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 679
|
Posted: Mon Jul 07, 2008 6:50 am Post subject: |
|
|
| Joy2DWorld wrote: | any setting differences w/ the odd machine,
for example: priv. differences, security settings, etc.
a anti-virus prog, etc.
ps: have you test ahk messaging, callbacks generally ? |
there are of course settings differences from user to user (not supposed to be) but since it works with one user and not the other then obviously there is som security or setting difference
anti virus settings are the same checked
as far as messeging callbacks
ok call me raving idiot can you elaborate maybe an example? _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 422 Location: Galil, Israel
|
Posted: Mon Jul 07, 2008 10:09 am Post subject: |
|
|
| Quote: | as far as messeging callbacks
ok call me raving idiot can you elaborate maybe an example? | check out manual on OnMessage() and RegisterCallback()
examples there also. _________________ Joyce Jamce |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 679
|
Posted: Mon Jul 07, 2008 12:42 pm Post subject: |
|
|
| Sean wrote: |
The actual error message in this case (:hr="") doesn't matter, and it might produce a lot of message boxes so better be warned. |
thanks sean i didnt actually see all the responses tilll this morning
i will give this a shot yea i think its settings as well but i feel like im in a moutain looking for a gadget and not really sure what the gadget loooks like
I was just hoping one of ya'll could help me naro the parameters a bit
ill cycle thru the error messages and see if anything pops out also we are goonna export the current user tree of the registry and import it and see if that has any affect of so we will start comparing differences wow what fun that will be
Edit this is the actual function in question
i have downloaded the latest acc and com libraries fyi
| Code: |
IE_InjectJS(MainWindow_Title, JS_to_Inject, VarNames_to_Return="",CheckState=0)
{
;~ Critical
COM_Error(False)
if MainWindow_Title is integer
ControlGet, hIESvr, Hwnd,, Internet Explorer_Server1, ahk_id %MainWindow_Title%
else
ControlGet, hIESvr, Hwnd,, Internet Explorer_Server1, %MainWindow_Title%
if Not hIESvr is Integer
{
MsgBox, 262160, Window Not Found, We are sorry!!!`nIt seems one of the windows needed to make this script work`n`n**%MainWindow_Title%**`n`ncould not be found
ExitApp
Return 0
}
IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}"
pacc := ACC_AccessibleObjectFromWindow(hIESvr)
pwin := COM_QueryService(pacc,IID_IHTMLWindow2,IID_IHTMLWindow2)
If JS_to_Inject
{
COM_Invoke(pwin, "execscript", JS_to_Inject)
}
If VarNames_to_Return {
StringSplit, Vars_, VarNames_to_Return, `,
Loop, %Vars_0%
Ret .= COM_Invoke(pwin,Vars_%A_Index%) . ","
StringTrimRight, Ret, Ret, 1
}
IfEqual,CheckState,1
{
loop 800{
Sleep, 500
COM_Invoke(pwin, "execscript", "var rdy=document.readyState;")
If (rdy:=COM_Invoke(pwin,"rdy") = "complete")
break
}
}
COM_Release(pacc),COM_Release(pwin)
Return Ret
} |
@ell
The second link sean posted is mineIf you need any help with anything there just post on that thread and ill do my best to help you out _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 679
|
Posted: Tue Jul 08, 2008 12:04 am Post subject: |
|
|
| Code: | Function Name: "execscript"
ERROR: (0x80020101)
PROG:
DESC: Could not complete the operation due to error 80020101.
HELP: C:\WINNT\system32\Mshtml.hlp,0
ERROR2: Not implemented
(0x80004001)
|
ok so thats the error
nothing promissing so far in google the only thing i found so far was a reference to http 1.1 enabled but this doesnt pan out since its enabled on one of the working profiles _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 679
|
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 679
|
Posted: Tue Jul 08, 2008 12:47 am Post subject: |
|
|
the culprit
drum roll please
a couple active x control called
owsBrowserUI Class
owsClientMiscApis Class
Disabled and rebooted pc all better now _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Tue Jul 08, 2008 3:09 am Post subject: |
|
|
| tank wrote: | the culprit
drum roll please
a couple active x control called
owsBrowserUI Class
owsClientMiscApis Class
Disabled and rebooted pc all better now |
Congratulation! A valuable info, btw. |
|
| 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
|