Payam wrote:
This would also be helpful for me...any pointers appreciated thanks.
Cornell: Can you post an example of how to use XML/REST with AHK? How do you"send" the xml request? (URLDownloadToFile I believe just retreives, does not send).
Thx
Payam
URLDownloadtoFile does indeed send ... (the "url" you specify to get the webpage is sending that URL !).
So ... while I am no expert, I got this to work by long hours of trial and error and tweaking. The system I am dealing with accepts "REST" requests and returns XML formatted responses.
In my case, the server has a https : //www.mainserver.com/RestRequests address and a protocol for REST requests such as (made up example below - first without AHK)
ProductID=33823023
ProductDetails=Yes
ProductImage=Large
and I need to include
UserID=mysuserid
Securitycode=1920932937237
which should return some XML such as
<ProductDetails>
<ProductType>Printer</ProductTyoe>
<Price>119.00</Price>
<Manufacturer>Lexmark</Manufacturer>
</ProductDetails>
<ProductImage>http://www.mainserver.com/lexmark124imagelarge.jpg</ProductImage>
-----
I should actually be able to type in this request into my browser ...
https : //www.mainserver.com/RestRequests?UserID=mysuserid&Securitycode=1920932937237&ProductID=33823023&ProductDetails=Yes&ProductImage=Large
----
Using AHK, you might code it as ...
request_header1=https://www.mainserver.com/RestRequests
request_header2=`?UserID`=mysuserid`&Securitycode=1920932937237
request_header3=`&ProductID=33823023`&ProductDetails=Yes`&ProductImage=Large
rest_request=%request_header1%%request_header2%%request_header3%
URLDownloadToFile,%rest_request%, c:\responsefile.xml
FileRead, xml_response_string, c:\responsefile.xml
----
so URLDownloadToFile send rest_request, and captures it in c:\responsefile.xml
then you read the response string (xml_response_string) and parse however you'd like
the code above is made-up for example ... and is of course not the bext way to code this, but written so you might be able to follow it and understand the main point
Hope this helps!