DjDeep00 Posted May 25, 2006 Share Posted May 25, 2006 Is anyone a Perl expert out there, who can convert the following Perl code to Autoit? #!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; my $userAgent = LWP::UserAgent->new(agent => 'perl post'); opendir DIR, "c:/XML"; my @files = readdir(DIR); closedir DIR; #print $files[2]; my $x = 2; while ( $x <= @files-1 ) { open(DAT, "c:/XML/".$files[$x]) || die("Could not open file!"); undef $/; my $raw_data = <DAT>; close DAT; $/ = "\n"; my $message = $raw_data; #print "XML Sent: "; #print $raw_data; my $response = $userAgent->request(POST 'http://199.168.1.88:5555/servlet',Content_Type => 'text/xml',Content=>$raw_data); open LOG, ">>C:/Log.txt"; print LOG $response->error_as_HTML unless $response->is_success; print LOG $response->as_string; close LOG; $x = $x + 1; } Thanx in advance. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 25, 2006 Share Posted May 25, 2006 Maybe for some of us that can help but dont know PERL could you explain what it does? Link to comment Share on other sites More sharing options...
DaleHohm Posted May 25, 2006 Share Posted May 25, 2006 It's opening all of the files in a particular folder, reading them in as raw XML and then posting them to a web address. Most of the code is just housekeeping. Why do you want to convert it to AutoIt? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
DjDeep00 Posted May 25, 2006 Author Share Posted May 25, 2006 It's opening all of the files in a particular folder, reading them in as raw XML and then posting them to a web address. Most of the code is just housekeeping.Why do you want to convert it to AutoIt?DaleDaleHohm you absolultely correct, thats exactly what I am doing.My main reason for converting is because you wont be able to execute the perl code on any computer. You will need to install activate now for the Perl script. If I can convert it to Autoit then I can just simply compile it to one exe. Any help would be appreciated. Link to comment Share on other sites More sharing options...
DjDeep00 Posted May 30, 2006 Author Share Posted May 30, 2006 Perl --> Autoit....Anyone? Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 30, 2006 Share Posted May 30, 2006 Perl --> Autoit....Anyone?HI,I think there are also perl2exe converter out there. So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
DaleHohm Posted May 30, 2006 Share Posted May 30, 2006 Is anyone a Perl expert out there, who can convert the following Perl code to Autoit? #!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; my $userAgent = LWP::UserAgent->new(agent => 'perl post'); opendir DIR, "c:/XML"; my @files = readdir(DIR); closedir DIR; #print $files[2]; my $x = 2; while ( $x <= @files-1 ) { open(DAT, "c:/XML/".$files[$x]) || die("Could not open file!"); undef $/; my $raw_data = <DAT>; close DAT; $/ = "\n"; my $message = $raw_data; #print "XML Sent: "; #print $raw_data; my $response = $userAgent->request(POST 'http://199.168.1.88:5555/servlet',Content_Type => 'text/xml',Content=>$raw_data); open LOG, ">>C:/Log.txt"; print LOG $response->error_as_HTML unless $response->is_success; print LOG $response->as_string; close LOG; $x = $x + 1; } Thanx in advance.The complicated piece is this line: my $response = $userAgent->request(POST 'http://199.168.1.88:5555/servlet',Content_Type => 'text/xml',Content=>$raw_data); Check out this desctiption of using XMLHTTP to post Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
DjDeep00 Posted June 7, 2006 Author Share Posted June 7, 2006 Dale, request(POST 'http://199.168.1.88:5555/servlet' ---> Instead of GET I am using POST. Content_Type => 'text/xml' ---> This is a header for HTTPS. Content=>$raw_data) ---> This is the data (xml). I know there is some kind of xml posting code for VB that you can use. Please let me know if you need more info on what that specfice line of code does. If you can just give it a shot and post the converted Autoit script, that would be awesome. Then I can play around with it and hopefully make it work. Thanks in advance. Link to comment Share on other sites More sharing options...
DaleHohm Posted June 7, 2006 Share Posted June 7, 2006 (edited) The complicated piece is this line: my $response = $userAgent->request(POST 'http://199.168.1.88:5555/servlet',Content_Type => 'text/xml',Content=>$raw_data); Check out this desctiption of using XMLHTTP to post DaleHmmm. I thought there was enough information at taht site for you to give it a shot... here is some help with syntax converting their example to something close for you in AutoIt: $xml = ObjCreate("Microsoft.XMLHTTP") $xml.Open("POST", "http://199.168.1.88:5555/servlet", False) $xml.setRequestHeader("Content-Type", "text/xml") $xml.Send($raw_data) Dale Edited June 7, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
DjDeep00 Posted June 7, 2006 Author Share Posted June 7, 2006 Hmmm. I thought there was enough information at taht site for you to give it a shot... here is some help with syntax converting their example to something close for you in AutoIt: $xml = ObjCreate("Microsoft.XMLHTTP") $xml.Open("POST", "http://199.168.1.88:5555/servlet", False) $xml.setRequestHeader("Content-Type", "text/xml") $xml.Send($raw_data) Dale You were rite there was enough info at that site. I just needed some help with the syntax and now I am GOOD TO GO! Thanx Dale. Link to comment Share on other sites More sharing options...
gamerman2360 Posted June 7, 2006 Share Posted June 7, 2006 Is there a difference between "Microsoft.XMLHTTP" and "winhttp.winhttprequest"? Link to comment Share on other sites More sharing options...
mary Posted February 13, 2007 Share Posted February 13, 2007 Is there a difference between "Microsoft.XMLHTTP" and "winhttp.winhttprequest"?very interesting question:i don't know but i tested them and it appear that winhttp is more rapid and you can do a loop WinHttpReq.send() with only one call to WinHttpReq.open()maybe other expert tell as more Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now