[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to Select Hosted FM Database from VB

Posted on 2014-02-20
13
Medium Priority
?
581 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:jwleys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +1
13 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:jwleys
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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:jwleys
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:jwleys
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 76

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:jwleys
ID: 39901422
Cool, thanks. I'll look into the launcher idea as an additional work-around.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

649 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