Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Open FileMaker & Run Script from WSH

Featured Replies

I'm running Windows XP with FileMaker 6.0.

I would like to have a (Windows) scheduled task run a FileMaker script at regular intervals. I'm pretty sure this can be done with vbscript (WSH). FileMaker has an example in the help section on how to do this but it's written for VBA not VBS and I think the syntax must be a bit different between the two "vb" languages.

Here's where I am so far:

Dim FMApp, FMDocs, FMActiveDoc

FMApp = FMPRO50Lib.Application

FMDocs = FMPRO50Lib.Documents

FMActiveDoc = FMPRO50Lib.Document

'Launch FileMaker

Set FMApp = CReateObject("FMPRO.Application")

'Set the Documents Object

Set FMDocs = CReateObject("FMApp.Documents")

'Make FileMaker visible

FMApp.Visible = True

'Open a file

myOpenFile = FMPRO50Lib.Document

Set myOpenFile = FMDocs.Open("c:FileMakerPart.fp5", "")

'Run a script

myOpenFile.DoFMScript("Import_All_Parts")

'Cleanup

Set FMDocs = Nothing

Set FMActiveDoc = Nothing

Set myOpenFile = Nothing

FMApp.Quit

Set FMApp = Nothing

It doesn't work. Any ideas?

Thanks,

Ted,

Hope this doesn't turn out to be good intentioned road kill. I get the feeling your FileMaker app, Part.fp5, is not running on a regular basis. That you are opening it up just to run the script then closing it again. If this is correct, why not set your task in XP to run Part.fp5 itself on a regular basis. Put your script in as the startup script. The script can finish by quitting the application. I haven't actually tried this mind you, but it does seem reasonable.

Cheers,

John.

  • Author

The script listed I just copied from FileMaker help and massaged a bit because it didn't work right-out-of-the-box. The Part.fp5 file will be operational 24 x 7 so I really don't need to open the application but for future reference I would also like to know how to open and close the FileMaker App via a script.

Ok, WSH doesn't have access to the FMP type library and in general does not need to have its objects defined like in VBA. Try this trimmed down version of the script:

Dim FMApp, FMDocs, FMActiveDoc

'Launch FileMaker

Set FMApp = WScript.CreateObject("FMPRO.Application")

'Set the Documents Object

Set FMDocs = FMApp.Documents

'Make FileMaker visible

FMApp.Visible = True

'Open a file

Set myOpenFile = FMDocs.Open("c:FileMakerPart.fp5", "")

'Run a script

myOpenFile.DoFMScript("Import_All_Parts")

'Cleanup - close the documents first so the app will close

FMDocs.Close

Set FMDocs = Nothing

Set FMActiveDoc = Nothing

Set myOpenFile = Nothing

FMApp.Quit

Set FMApp = Nothing

Cheers,

John.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.