Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Executing PHP code in QM
#1
These functions can be used to execute PHP code in QM.

Although PHP usually is used in web servers, it also can be used in your computer. You only have to download and install PHP, which is as easy as installing QM or any other program.

Examples:
Code:
Copy      Help
lpstr code=
;shell_exec('notepad');
PhpExec code

Code:
Copy      Help
PhpAddCode "function Add($a, $b) { return $a+$b; }"
int sum=PhpFunc("Add" 1 2)
out sum

Download and import the attached file. Read the first macro...

Current PHP version (5.2.8) does not have activescript. I could not find where it can be downloaded separately. Attached activescript dll of PHP 5.2.6. Download it and move to PHP folder.

SECURITY NOTE: Active script engines can be used in web pages. Some malicious web pages may run PHP on your computer when you open them in your web browser. However this probably is not true with current browsers. I tried PHPScript in web page, in IE and firefox, and it did not run.


Attached Files
.qml   Php.qml (Size: 4 KB / Downloads: 888)
.zip   php5activescript.zip (Size: 17.88 KB / Downloads: 726)
#2
qm occasionally crashes when executing the same code. it also happens with the example that pulls up notepad but everytime.

there was an issue with registering the dll. it failed cuz it couldnt find "php5ts.dll" when i selected C:\Program Files\PHP\ext\php5activescript.dll so i copied php5ts.dll into the ext directory. could that be the issue?

btw: i only have the activescripting extension installed.
An old blog on QM coding and automation.

The Macro Hook
#3
I tested only on Vista, and there works well. Now also installed on XP, and QM crashes as you say. Will try to debug.

php5activescript.dll registration did not require other dlls.
#4
thanks!!
An old blog on QM coding and automation.

The Macro Hook
#5
Updated.

QM crashes when the thread ends. But if there is a small delay or just Sleep(0) before ending, then always works well. The new version of the functions automatically calls Sleep(0). Didn't find the reason and not sure if it will work well on all computers. If still not, try to replace Sleep(0) to wait 0.05.

Php engine is not so lightweight as VBScript. It creates 7 extra threads (VBScript - 1), 2 of them with hidden windows, 4 of them remain even when the thread ends.
#6
works great!!
thanks for expanding this into yet another scripting platform!!!!
An old blog on QM coding and automation.

The Macro Hook
#7
Hi,
I don't really know much about php or other scritpting languages. Are there any sample scripts or other cool examples that could be easily integrated into ones QM scripts?

Stuart
#8
i have a php script that connects to our paging provider to send pages but that's about it.
i doubt it would be of use but i can post it if you like.
An old blog on QM coding and automation.

The Macro Hook
#9
http://www.php.net/manual/en/
#10
I will look through the manual. We are doing something different with our paging system but thank you also.

Stuart
#11
999 Tutorials - Create excel files with php
http://www.999tutorials.com/tutorial-cr ... h-php.html
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)