Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to Select Hosted FM Database from VB

Posted on 2014-02-20
13
Medium Priority
?
590 Views
Last Modified: 2014-03-03
I want to call a FileMaker script from VB.Net. The database is always open (remote connection to a hosted version). How do I assign the open database to a variable? I cannot open the database, since it is already open.

Same code as follows:

Set objFM = WScript.CreateObject("FMPRO.Application")
objFM.Visible = True
Set objFMfile = [*something here to assign current active database*]
objFMfile.DoFMScript ("PDF_check_status")

Open in new window

0
Comment
Question by:Jeremy Leys
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 25

Expert Comment

by:Will Loving
ID: 39875137
I have no knowledge of VB, but FileMaker does include the ability to call scripts via a URL. For example: FMP://192.168.10.0/Clients.fmp12?script=ListClients

See the following FileMaker Knowledgebase article for more information on how to do this:

https://www.filemaker.com/12help/html/sharing_data.16.7.html
0
 

Author Comment

by:Jeremy Leys
ID: 39875315
Thanks for the suggestion. I still need to call a FileMaker script from VB (or any other external script – I am open to suggestions). Using VB to call a URL to execute the script would be good, but that doesn't seem to be working either. I have tried the following:

NavigateWebURL("FMP://[username]:[password]@[database].fmp12?script=PDF_check_status", "default")

Open in new window


and

Dim myRequest As WebRequest = WebRequest.Create("FMP://[username]:[password]@[database].fmp12?script=PDF_check_status")

Open in new window


and

Process.Start("FMP://[username]:[password]@[database].fmp12?script=PDF_check_status")

Open in new window


I have tested a URL call from within FileMaker, so I know the path is correct. I just need to get it working from an external source.

Many thanks!
0
 
LVL 25

Expert Comment

by:Will Loving
ID: 39875753
Well, as I say, I have no experience with VB, so perhaps someone else will respond...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Jeremy Leys
ID: 39875852
Thanks for your help, doesn't have to be VB (stuck on a Windows server so can't use Apple Script), I tried doing a URL call from Filemaker but have found that Filemaker 13 Server doesn't have the ability to call scripts via a URL. I can do this easily from the client application but not the server.

Thank you for your time and input it is much appreciated.
0
 

Author Comment

by:Jeremy Leys
ID: 39875857
Unfortunately have to use the server as the server is used to render a WebDirect website which the users will be interacting with. So user interaction is via browser not a Filemaker client application.
0
 
LVL 25

Expert Comment

by:Will Loving
ID: 39875899
If you are using WebDirect, why not just access the database directly within a browser window using the URL for the server instead of trying to call a script?  A simple <a href= with the proper URL string should open the database in a window or a frame.
0
 
LVL 1

Accepted Solution

by:
grnassar earned 1500 total points
ID: 39876970
How about a .fmp12 "launcher" file, with a OnFirstWindowOpen script trigger that runs a local script that does nothing but Perform Script the script in the hosted file and then Close File[current file]?

So, in other words, same principle as the "opener" file idea in the FM knowledgebase:

http://help.filemaker.com/app/answers/detail/a_id/5296/~/how-to-create-a-way-to-quickly-open-networked-files-in-filemaker-pro

but instead of it opening the networked file, it performs a script in the already-opened file?  You can then "open" the default-closed launcher file, and it returns to closed by itself once the script completes.
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 39876983
In legacy VB, you can get the application object (if it is COM-enabled) with GetObject
Set objFM = GetObject(,"FMPRO.Application")

Open in new window

0
 
LVL 1

Assisted Solution

by:grnassar
grnassar earned 1500 total points
ID: 39877451
I still like the "launcher" solution, as IMHO FileMaker can be a little squirrely with filesystem scripting and works best with its native scripts.  That being said, since this has now been moved to the VBScript zone:

Your code looks fine.  (You don't need the application to be visible - FM responds fine from the background.)

All it seems you're missing is how to assign the right document to your objFMFile variable.

The Documents collection in the application object holds all your open files.  Documents has an Item() property that you can pass the file name as a string (FM's docs say full pathname, but since yours is hosted I think just the file name is needed; not even sure if it needs the extension -- may want to try it both ways) and it will give you the particular Document object for that specific file.

If for some reason that doesn't work, you may just have to iterate over the Documents collection looking at Document.FullName until you find the file you want.  But I don't think that'd be necessary in this case.
0
 
LVL 1

Expert Comment

by:grnassar
ID: 39877467
I should've included this with the explanation above:

http://www.filemaker.com/help/html/create_script.12.13.html

That's from the FM13 help, but the actual objects, methods and properties available haven't changed since at least FM11 and probably since well before.
0
 

Author Comment

by:Jeremy Leys
ID: 39901422
Cool, thanks. I'll look into the launcher idea as an additional work-around.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question