Jump to content

Recommended Posts

Posted

Please forgive my ignorance here, I'm sure I will call everything the wrong name. I need to send a url to a local file from an autoit script and can't seem the get it working. When I type the url into a browser address bar and hit enter it does exactly what it's supposed to do (i.e. change apps and execute an internal script with parameters passed in the url [not an autoit script]). But I don't want to use a browser to send the url, I want to do it silently from the autoit script.

Most of the searches I did turned up requests to execute a url in the default browser, etc. I found THIS and THIS from Brugbart.com but I can't get it to work, not even with the copied and pasted solution at the end of his page. I tried using all sorts of stuff using run but never found one that worked.

Seems like this should be easy but....................................help

Cheers!

Posted (edited)

Well the url is fmp: and about 100 charachters.

the code I tried from the link in my first post was copy and paste but with my url instead of the one in the solution.

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "fmp://MyURL", False)

$oHTTP.Send()
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

If $oStatusCode == 200 then
 $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
 FileWrite($file, $oReceived)
 FileClose($file)
EndIf

Edit: the above code seems to error at the "." in $oHTTP.Open if that helps?

I have tried:

run("explorer.exe fmp://MyURL")

and

run("MyApp.exe fmp://MyURL")

and a few others.

The URL is good as it executes properly when I put it onto a browser address bar and hit enter. I just can't figure out how to mimic that from Autoit without the browser.

Edited by onefish
  • Developers
Posted

You are still faling to provide exact details as to the error you get some snippet that matches what you are doing.
You can't honestly expect anyone to guess what the problem could be. ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Sorry Jos, I don't want to post the whole url as it contains username and password information. I am simply trying to send the URL from autoit instead of the browser address bar. I don't really know exactly what the browser is doing or how the url is handled by it but I know it works properly from there. The url is somehow directed to a locally hosted application on the same PC, no dns resolving or anything as I can disconnect from the internet and it still works. The URL itself contains data the tells the application to run a script with a parameter (native, non-autoit).

The error I get when running the code from the link in my first post and pasted in my second post is:

$oHTTP.Open("GET","fmp://M......."

$oHTTP^ERROR

If I change get request to be "http://fmp://M........"

Then the error flag moves down the script to:

$oHTTP.Send()

$oHTTP^ERROR

But I'm even not sure if this code is the right way to achieve what I need to achieve. I just thought I'd try it because I couldn't get run to send the url request.

  • Developers
Posted (edited)

Understand, but give us something that mimic's the error. The provided info doesn't so there is not way we can even remotely know what the issue could be.

On top of that, you still haven't provided the error description you get for the errors you get, which makes it even harder. :)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Sorry again, I'm pretty green with AutoIt. the "^ERROR"/s that I posted is all that I see in the bottom section of ScitIE. Is there another way to see a better description of the error?

It would be nice to know if Braggart's approach is the right way to send a URL from AutoIT,or if there's a better way.

  • Developers
Posted (edited)

Normally there is an error description and the line pointing to the place of the error in the SciTE outputpane.

Just post the whole output (after removing any privacy stuff)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Below is output using "http://fmp://...." which just seems wrong

>"C:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Someone\Downloads\FMP_URL.au3" /UserParams   
+>22:01:00 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X86    Environment(Language:0409)
+>         SciTEDir => C:\Program Files\AutoIt3\SciTE   UserDir => C:\Users\Someone\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Someone\AppData\Local\AutoIt v3\SciTE
>Running AU3Check (3.3.14.2)  from:C:\Program Files\AutoIt3  input:C:\Users\Someone\Downloads\FMP_URL.au3
+>22:01:00 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Someone\Downloads\FMP_URL.au3"   
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\Users\Someone\Downloads\FMP_URL.au3" (7) : ==> The requested action with this object has failed.:
$oHTTP.Send()
$oHTTP^ ERROR
->22:01:07 AutoIt3.exe ended.rc:1
+>22:01:07 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 7.904
 

Below just using "fmp://...." see the error happens earlier in the script

>"C:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Someone\Downloads\FMP_URL.au3" /UserParams   
+>22:09:22 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X86    Environment(Language:0409)
+>         SciTEDir => C:\Program Files\AutoIt3\SciTE   UserDir => C:\Users\Someone\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Someone\AppData\Local\AutoIt v3\SciTE
>Running AU3Check (3.3.14.2)  from:C:\Program Files\AutoIt3  input:C:\Users\Someone\Downloads\FMP_URL.au3
+>22:09:22 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Someone\Downloads\FMP_URL.au3"   
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\Users\Someone\Downloads\FMP_URL.au3" (5) : ==> The requested action with this object has failed.:
$oHTTP.Open("GET","fmp://A/WHOLE/LOT/OF/STUFF/HERE", False)
$oHTTP^ ERROR
->22:09:22 AutoIt3.exe ended.rc:1
+>22:09:22 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 1.15
 

Edited by onefish
Posted

Yep Filemaker Pro. The URL is good, that's not the problem. It does exactly what it's supposed to do when I send it via a browser. I'm just trying to work out how to send it without the browser.

Posted (edited)

run this:

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
If Not IsObj($oHTTP) Then
    MsgBox(0,'Error','No Object created')
    Exit
EndIf
$oHTTP.Open("GET", "fmp://MyURL", False)

$oHTTP.Send()
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

If $oStatusCode == 200 then
 $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
 FileWrite($file, $oReceived)
 FileClose($file)
EndIf

and tell if MsgBox appears. If not, post a anomysized url (in original scheme) of your browser after he has connected. 

Edited by AutoBert
Posted
19 minutes ago, onefish said:

It's just pretty universal and doesn't require any additional setup on the database side.

But the fmp protocol is not universal.  It seems to require a FileMaker install on the machine you are running your script on that registers fmp as an internet protocol.  This page lays out all the requirements and formats for the url request.   Do you have FMP installed on the machine with your script?

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Posted

I have been reading a bit more and fmp: is registered as an internet protocol in the local machine. I'm thinking that winhttp may not be the right way to go as it appears to have errors if the request is not http but fmp. Does this sound right?

Posted (edited)

Database and script is on the same machine. The database actually initiates the AutoIt script with parameters. Then the AutoIt script does some things that the database can't do and the sends the info back using the fmp url (or at least that's what it's supposed to do).

By universal I meant to the purpose of the database/AutoIt script solution :)

Edited by onefish

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...