| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Jul 30, 2008 6:52 am Post subject: Please help resolving xpath error. |
|
|
Here is the code i m using.
| Code: |
#include xpath.ahk
xml =
(
<?xml version="1.0" encoding="UTF-8"?>
<Default>
<detector maxRotationRadius="37.1" gradedAbsOpacity="0.298" actualAngularTicks="4" detectorThickness="2.54" systemType="2.0" axialDetectSizeCM="40" detectorOpacity="0.58" transDetectSize="54"
/>
</Default>
)
xpath_load(xml)
MsgBox % "maxRotationRadius=" . xpath(xml, "/Default/detector/@maxRotationRadius/text()")
. "`ngradedAbsOpacity=" . xpath(xml, "detector/@gradedAbsOpacity/text()")
. "`nactualAngularTicks=" . xpath(xml, "detector/@actualAngularTicks/text()")
|
But when i run the script i am getting NumPut function error pointing to the xpath.ahk
Please help resolving this error. |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Wed Jul 30, 2008 7:08 am Post subject: |
|
|
| I believe that XPath_Load() expects a file, not a string? I might be wrong about this. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Wed Jul 30, 2008 7:38 am Post subject: |
|
|
Is the error saying tha NumPut is an invalid function? If so, you need to update your version of AHK, which will add this function for you.
In the future, please post your question to the topic that you got the script from. I wouldn't be surprised if someone else has had the same problem and posted there. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Hasso
Joined: 23 Mar 2005 Posts: 158 Location: Germany
|
Posted: Tue Aug 26, 2008 10:14 am Post subject: |
|
|
I got a similar error and added a space between xpath_load ( and the opening bracket - then it was accepted! _________________ Hasso
Programmers don't die, they GOSUB without RETURN |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Tue Aug 26, 2008 7:35 pm Post subject: |
|
|
| Hasso wrote: | | I got a similar error and added a space between xpath_load ( and the opening bracket - then it was accepted! |
If you do it like that, XPath_Load is no longer regarded as a function, but as a variable. For example: | Code: |
Var := XPath_Load(xml) |
assigns the return from XPath_Load(xml) to the variable "Var".
| Code: | | Var := XPath_Load (xml) |
assigns the variable "XPath_Load" followed by the variable "xml". The former is probably blank, and so Var will most likely become equal to "xml". _________________ PlayAHK! Try it out  |
|
| Back to top |
|
 |
|