viewpoint-particle

Author Topic: Non-HTTP URL  (Read 774 times)

PaulSamuelson

  • Newbie
  • *
  • Posts: 45
Non-HTTP URL
« on: February 03, 2023, 08:27:43 am »
How can I open a non-standard URL?

I would like to connect to something like fmp://myhost/myfile?script=myScript

Thanks,

Paul Samuelson

td

  • Tech Support
  • *****
  • Posts: 4441
    • WinBatch
Re: Non-HTTP URL
« Reply #1 on: February 03, 2023, 01:31:21 pm »
Based on the definition of a URL the URL you are referring to is a standard. How you access the resource would depend on how the "fmp" protocol is implemented on your system and/or the server providing the resource. There are many ways to access resources via URLs using WinBatch but I am not familiar with that protocol so I cannot provide any information on accessing this particular resource. If you learn more about the resource and protocol, a WinBath access method may become obvious.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

ChuckC

  • Sr. Member
  • ****
  • Posts: 435
Re: Non-HTTP URL
« Reply #2 on: February 04, 2023, 06:47:22 am »
Just for kicks, giggles & grins, try hitting WIN+R and in the text field for a program name, paste the URL and click "OK".  That will invoke some form of the ShellExecute() WIN32 API function.  If the shell environment has a URL handler registered, it'll launch an appropriate program.  If that is successful, then WinBatch can invoke the same API function.  In man cases, what I'd expect to have happen is for the default web browser to be opened with that URL, and if the protocol in the URL is well known, the browser may already have the capability of handling it like for HTTP, HTTPS, FTP, etc.  If it's a less well known protocol not supported by default, there may be the possibility of having a browser extension of some kind installed to allow the browser to handle it.

Worst case, you have to research the protocol itself based on the RFC standards/specification document that defines it and then write code of your own to implement the protocol.  I've written a Telnet client in WinBatch before using nothing but the TCP socket communications capabilities, so depending on the nature of the protocol, you might possibly have some success doing that kind of thing yourself.

For example, a Google search for the keywords 'url with "fmp" protocol' leads to the following results:

https://fmhelp.filemaker.com/help/14/fmp/en/html/sharing_data.17.6.html

https://www.twdesigns.com/fmp_url_protocol/

Those look like a very good place to start your research.

td

  • Tech Support
  • *****
  • Posts: 4441
    • WinBatch
Re: Non-HTTP URL
« Reply #3 on: February 04, 2023, 08:46:26 am »
If a person has the time and inclination, they could always search the registry for the URI's protocol. This could end up being more confusing than useful but it is a way to see exactly how the protocol is integrated into the system. The HKEY_CLASSES_ROOT key is a good place to start if so inclined.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

PaulSamuelson

  • Newbie
  • *
  • Posts: 45
Re: Non-HTTP URL
« Reply #4 on: February 06, 2023, 09:18:37 am »
Chuck,

My objective is to reliably trigger scripts in FileMaker Pro after a WinBatch process. I have been using SendMenusTo() with moderate success, but moderate success is not good enough for a loop that runs continuously. It sometimes fails to trigger the script, breaking my automation loop.

The fmpURL works from a browser. It works from Run...

I now plan on using:

Code: Winbatch
url = "fmp://myhost/myfile?script=myScript"
objShell = ObjectCreate("Shell.Application")
objShell.ShellExecute(url)
objShell = 0

I will try it to see if it is more reliable than SendMenusTo().

Chuck, 20 years ago you helped me get started making DLL calls in WinBatch. Thanks again getting me started and helping with my current issue.

-Paul

ChuckC

  • Sr. Member
  • ****
  • Posts: 435
Re: Non-HTTP URL
« Reply #5 on: February 06, 2023, 11:29:23 am »
Has it been 20 years already? :P  I started working with WinBatch in 1996 with the 16-bit version on Windows 95.

Does FileMaker Pro support a COM interface to invoke a script and test for its completion?

PaulSamuelson

  • Newbie
  • *
  • Posts: 45
Re: Non-HTTP URL
« Reply #6 on: February 06, 2023, 01:57:18 pm »
FileMaker does (or at least did) support COM, but I can't find any good documentation. They encourage use of their Data API, but I need to talk to clients, not the server. I use ODBC for WinBatch access to server data.

So far, so good with ShellExecute(). It has not missed a beat.

td

  • Tech Support
  • *****
  • Posts: 4441
    • WinBatch
Re: Non-HTTP URL
« Reply #7 on: February 06, 2023, 03:11:42 pm »
Assuming by "ShellExecute" you are using the COM version. Why not try using the WIL function ShellExecute instead? For the most part, it uses the same registry mappings as the COM version you are using without the COM overhead.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

PaulSamuelson

  • Newbie
  • *
  • Posts: 45
Re: Non-HTTP URL
« Reply #8 on: February 07, 2023, 07:14:59 am »
The WIL ShellExecute() requires an application as the first parameter. The machines running it may run different (or even multiple) versions of FileMaker. The COM version uses the registry to automatically find the correct application for the fmp URL.

td

  • Tech Support
  • *****
  • Posts: 4441
    • WinBatch
Re: Non-HTTP URL
« Reply #9 on: February 07, 2023, 08:52:28 am »
That is not quite true. It all depends on how the URI is mapped in the registry.  Consider the following:

Code: Winbatch
ShellExecute("https://forum.winbatch.com/index.php?topic=2899.msg16693#msg16693","","", @normal,"open")

WinBatch uses the same Windows Shell API functions the COM version of ShellExecute uses.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade