Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Executing PHP code in QM
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.

Copy      Help
lpstr code=
PhpExec 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: 661)
.zip (Size: 17.88 KB / Downloads: 486)
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
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.
An old blog on QM coding and automation.

The Macro Hook

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.
works great!!
thanks for expanding this into yet another scripting platform!!!!
An old blog on QM coding and automation.

The Macro Hook
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?

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
I will look through the manual. We are doing something different with our paging system but thank you also.

999 Tutorials - Create excel files with php ... h-php.html

Forum Jump:

Users browsing this thread: 1 Guest(s)