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.

Windows WSH-VBS script doesn't work on FM7

Featured Replies

Hi gang,

My Windows WSH VBS script works perfectly in FMPro 5 and 6, but fails in FM 7. (for those Mac folk, VBS scripts are like Applescripts)

I want my Windows XP WSH/VBS script to start Filemaker and execute a FM Script. Under FM7, the Documents.Open script step fails on an error - "wrong number of arguments"

Any ideas??

THANKS! -Cliff Sunday evening June 27 2004

Here's the VBSscript:

Dim FSO

Set FSO = CreateObject("Scripting.FileSystemObject") 'FSO is filesystemobject

Set objFM = WScript.CreateObject ("FMPRO.Application") 'open FileMaker

objFM.Visible = True ' show FileMaker. Hidden by default.

'

' NEXT LINE WORKS UNDER FM6 AND FAILS UNDER FM7

'

Set objFMfiles = objFM.Documents.Open("C:Invoices for AcmeInvoices.FP7","")

'

' Fire up a Filemaker Script...

'

objFMfiles.DoFMScript ("Move shipping data") ' call this FM script

wscript.quit ' goodbye to the WSH script

Found this in FM Help

Methods

Open(filename As String, accountName As String, password As String): Opens a specific FileMaker Pro file, creates a Document object, and returns a pointer to the Document object.

Looks like there are three parameters in the FM7 version, since you have to specify an account name and password, not just a password.

I didn't know you could use ActiveX from vbscripts and wsh. I though you had to use vb or vc++. That could make some things a lot easier.

Do you know if it's possible to use WSH/ActiveX/VB script with a run-time solution on a computer without Filemaker installed?

  • Author

AHA! I'll bet that's the problem ... thanks Reed!

Yes, you can fire up Filemaker and run a FM Script from the Windows Script Handler. This is on all Windows XP machines (and older Windows systems as well). I have not tried it on a run-time solution without FM.

By way of saying THANKS for your help, here's a useful WSH script I've put togetyher. I've discovered several tricks to get data passed between WSH/VBS and Filemaker ... for instance, WSH/VBS does not know about the copy/paste buffer.

But here's a kludge to read the clipboard from WSH:

Set oHtml = CreateObject("htmlfile") ' THis is used for the copy clipboard

'.... windows script stuff to start a FM script and get some text into copy buffer

Set objFM = WScript.CreateObject ("FMPRO.Application") 'open FileMaker

objFM.Visible = True ' show FileMaker.

Set objFMfiles = objFM.Documents.Open("C:Invoices 2003.fp7","AccountName","Password") ' open FileMaker file

' now run a FM script which will put useful info into the clipboard

objFMfiles.DoFMScript ("Get Payment Info") ' Run this FM script.

' That FM script pastes "OK" or "NOGOOD" into the clipboard.

' now read the copy/paste buffer into WSH:

sClipText = oHtml.ParentWindow.ClipboardData.GetData("text")

' show the /OK/ or ?NOGOOD/ on a windows script command window:

WScript.Echo sClipText

' now you can test the value...

If ( (instr(1, sclipText, "OK) ) Then

'do something

Else

'do something else

End If

Wscript.Quit 0 'normal exit

Thanks Cliff for the script smile.gif

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.