June 28, 200421 yr 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
June 28, 200421 yr 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.
June 28, 200421 yr Do you know if it's possible to use WSH/ActiveX/VB script with a run-time solution on a computer without Filemaker installed?
June 28, 200421 yr 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
Create an account or sign in to comment