|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-03 11:55 UTC] csaba at alum dot mit dot edu
[2007-04-11 14:59 UTC] wharmby@php.net
[2007-04-11 21:00 UTC] csaba at alum dot mit dot edu
[2007-06-06 22:24 UTC] sniper@php.net
[2007-09-07 01:18 UTC] csaba at alum dot mit dot edu
[2017-10-24 03:31 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: wharmby
+Assigned To:
[2021-05-03 11:35 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2021-05-03 11:35 UTC] cmb@php.net
[2021-05-16 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 13:00:02 2025 UTC |
Description: ------------ My script brings up an instance of IE, and then it places onto IE a function that will execute one of the script's functions (within the script's environment). This is a normal scenario usually achieved through com_event_sink in PHP. However, I have implemented this independent of events. I have both a VB and PHP version, both are working fine from the command line, thanks very much. The problem is that when I run the PHP version using the scheduler (either AT or SchTask), I get an IE error IE right at the point that it tries to call back into the script (a permissions issue?). The scheduled VB version works fine, and if I schedule PHP to invoke the VB version that works just fine, too. Csaba Gabor from Vienna Reproduce code: --------------- <?php $ie = new COM("InternetExplorer.Application"); // new IE $ie->visible = true; $ie->Navigate2("about:blank"); // empty DOM while ($ie->readyState<4) usleep(10000); // wait for IE $window =$ie->document->parentWindow; $window->execScript("window.doneP=false"); // init var $oScript=new COM("MSScriptControl.ScriptControl"); $oScript->Language = "VBScript"; $oScript->AddCode('Sub EvtWrapper() CreateObject("WScript.Shell").Popup _ "ScriptControl reached", 4, "WScript popup", 131120 End Sub'); $oScript->AddObject ("mydoc", $ie->document); $oScript->ExecuteStatement( 'mydoc.onclick=GetRef("EvtWrapper")'); $window->execScript( "window.myfunc=window.document.onclick"); $window->setTimeout("window.myfunc()",100); mypopup("At com_message_pump"); try { while (!$window->doneP) com_message_pump(500); } catch (Exception $e) { popup ("In the catch"); } mypopup ("Done with script"); function mypopup ($text) { $oWSH = new COM("WScript.Shell"); $oWSH->Popup($text, 4, "PHP Popup", 131120); } ?> Expected result: ---------------- I expect this script, schTest.php, to not error when it is scheduled with AT as: AT 14:10 %comspec% "/K php c:\path\to\schTest.php" In particular, just as when it is run directly, IE should come up, and then there should be two popups: "At com_message_pump" followed by "ScriptControl reached". Once IE is dismissed, there should be two more popups: "In the catch" and "Done with script" Actual result: -------------- When SchTest.php is run directly (or via a .vbs invocation) then all four popups show normally. However, when schTest.php is scheduled through AT, then there is an IE error saying Line: 0 Error: Object doesn't support this property or method. When I try the scheduling through SchTask (same results as with AT), then it is scheduled as NT AUTHORITY\SYSTEM (no password). I'm the only user on my system and since I don't have a password, I haven't figured out how to schedule tasks to run under my user name. I am happy to provide the corresponding VBScript code if it would be helpful.