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.

Pass an argument out of FM7D?

Featured Replies

I thought I had a solution, pass via the clipboard, but I'm haveing a problem with the Copy function.

How else would you pass the contents of the current field to a program outside of Filemaker, in this case vbscript? I'm putting it into a text field.

Thanks,

Jerry

It's probably best not to fool with people's clipboard anyhow, unless it can't be avoided. Can you narrow your found set to one record and export the field to a csv file, where VBS can pick it up? Or do you not know which field you'll be exporting?

Jerry

If the field's value is a parameter to your VB program, you can pass it as a command line argument using Send Message.

Steve

Both of these approached works. Steveinvegas' one is more elegant. The VBscript needs to changed a little to allow for command line arguments but that's not too much work.

  • Author

I was trying to avoid creating and reading a file, must be something more elegant.

Send Message sounds like the thing, but what is it? I've been using Send Event to run scripts for awhile, but I see no Send Mssage that would run a script and present it with an argument.

I've been all over the help file and see no mention of running a script with an argument.

Could you enlighten me?

Thanks,

Jerry

Hi Jerry,

Excuse me for jumping in late, I waited because you were already receiving help from three of our best, besides you all are Windows users, and that is something I don't know much about.

However, I'm always up for a good argument smile.gif so I was wondering what exactly you were meaning here by "argument" in FileMaker. To me, it would mean using a If Statement, or Case Statement. In a Script, the If and Else Script Steps. However, I get the feeling I'm missing some vital information here. Almost like this a carryover conversation from a different tread. or something.

My question would be, what are you trying to accomplish with this os called "argument". What field information are you trying to pass to What Program?

So, if this is a carryover thread, a reference is the other thread might be helpful. If not, you need to supply more of the particulars of what you are trying to accomplish.

Lee

confused.gif

Send Message may have been changed to Send Event in v7 (it exists in v6 and below).

Lee is right...if we had more details we could guide you better.

Steve

  • Author

Sorry, you're right, I should have been more explicit.

Here's what I'm doing: I administer a small network of about 350 PC's (and about 350 Macs, that I currently don't support directly, but I'll be going there), in an AD/OD domain in a university setting. I use vbscript, WMI, enterprise versions of anti virus, firewalls, anti spyware, etc. to scan, maintain, and support them and FM holds the database. My users (pretty much all faculty or grad students) are administrators on their computers (and psychologists...) - so they keep me hopping.

The general problem is doing something on a remote computer from within FM.

The thing I want to do now is to push a button in FM associated with a record (of a PC computer in this case) that runs a script that starts a RemoteDesktop session on the remote computer. This is sort of important to me as I've got some mobility issues. The vbscript takes an argument in the form of an IP address and puts it into a .rdp file (the file type that Microsoft's RemoteDesktop uses) the script then runs RemoteDestop to connect to that PC.

I got it working using the clipboard, but there is an issue with Copy on my computer, and I don't think that's an elegant solution anyway.

I want to use something like the SendEvent FM script function to run the RemoteDesktop script and pass it an argument. But it's not clear how to do that. Perhaps I simply don't understand the Send Text part of Send Event.

And, yes I'm sort of new to FM.

Thanks for the help,

Jerry

  • Author

Ok, I suppose the silence means FM can't do exactly that.

I can work around by simply recreating the .rdp file each time.

Perhaps FM can solve this in the next round of development. I see it as a need, do others?

Jerry

Ok, I suppose the silence means FM can't do exactly that.

Or we're waiting on some others who know VB to answer the question ...

I tried to do a mock-up of this, but I was unable to find an .rdp file to see how it works. Can you change the remote address in the .rdp to 127.0.0.1 and post it here?

J

QuinTech,

Here's a sample .rdp file. I messed around with it for about 15 minutes without any luck but I think it should work.

Lee,

By "passing arguements" I think what tooluser is trying to do is run an application external to FileMaker and provide it with some additional (variable) information that will assist it in its job. For instance maybe the external program collects physical traits. The command line would be something like this:

Traits.exe /brown /blue /caucasian /36 /24 /36 wink.gif

Sample.zip

Thanks, Ted. I was hoping there would be some sort of command-line switch for an RDP file (something as easy as sample.rdp -127.0.0.1 would be nice), but I can't find any such thing.

The only thing I can think of -- and toolUser, I know you said you didn't want to go this route -- is to create the rdp file dynamically using an export and some convenient Send Event steps. See attached.

J

CreateRDP.zip

You can use WinBatch to do what you want. I pass it commandline arguments all the time.

Steve

QuinTech,

Your solution works perfectly for me. I personally don't have any real need for this but it does indeed work just fine.

  • Author

Yes, I can get FM7 to create the .rdp file with the correct IP inserted. Which I can use as an argument to remoteDesktop (mstsc.exe) which is run by a vbscript that tests to see if the remote computer is up, if someone is logged on, who that is, with the option of sending a request to log on, which blanks the screen.

Sorry if my description was confusing, the .rdp file is the argument to mstsc.exe. What I wanted was an argument to a vbscript script (in this case an IP address) that would do the heavy lifting regarding building the .rdp and running mstsc. It may sound trivial, the difference between building the .rdp in vbscript vs FM, but vbscript is reasonably powerful and once you have the ability to pass an argument you can probably do a lot more with vbscript.

So, I do have a solution to my problem, just not as elegant as I hoped.

-----

Ted S has it exactly right.

I think the ability to run a program (say, Traits.exe) outside FM and pass it an argumnent or two from specific FM fields in the current record ( /brown /caucasian) would be very elegant and useful. At least on a PC.

Thanks for the help.

Jerry

Sorry if my description was confusing, the .rdp file is the argument to mstsc.exe. What I wanted was an argument to a vbscript script (in this case an IP address) that would do the heavy lifting regarding building the .rdp and running mstsc. It may sound trivial, the difference between building the .rdp in vbscript vs FM, but vbscript is reasonably powerful and once you have the ability to pass an argument you can probably do a lot more with vbscript.

I'm still not 100% sure I understand but here goes:

you want a VBscript that will generate the RDP file and immediately launch mstsc with that rdp file. Problem is you need to feed an argument to the VBscript and that argument is the IP address that needs to go in the RDP file.

That's easy enough: VBscripts can take arguments so all you need to do is create a Send Event that calls the VBscript and gives it the argument (like you would from the command line:

cmd /c cscript c:wherevervbscript.vbs 192.169.1.88

Am I missing something?

  • Author

Yes, vbscript takes an argument, thanks to WSH, but how do you get the argument out of FM?

In the SendEvent function I don't see how you both run the script and give it an argument that represents, say, a field in the current record.

Calling <cmd /c cscript c:wherevervbscript.vbs 192.169.1.88> is fine, but the IP address needs to be a variable.

I suspect I'm just missing something, can you do it from a SendEvent calculation?

Jerry

Yes, if you pass a field definition rather than text. Create a calc field which is equal to "cmd /c cscript c:wherevervbscript.vbs " & theIPAddress where theIPAddress is a global field that can be edited as necessary.

yep. Send Event can take a calculated string...

  • Author

QuinTech said:

"Yes, if you pass a field definition rather than text. Create a calc field which is equal to "cmd /c cscript c:wherevervbscript.vbs " & theIPAddress where theIPAddress is a global field that can be edited as necessary. "

Thanks for the help.

Some things still aren't clear to me, however. I suspect it's my unfamiliarity with FM.

q1: How do you pass a field definition rather than text?

I see a place to send a calculation, but that's not it, right? You mean a calc field in the table with the IP address, right?

The other choices are to send a file or text. Do you point to the field def in the text box? How?

q2: Why is IP address a Global field? Wouldn't it be the IP address in the current record? Or, do I misunderstand Global's? I thought they were essentially constants; same content in each record (actually a pointer to content, I suspect).

Thanks,

Jerry

And sorry for being so obtuse...

a1: Oops, what I was suggesting was possible in FMP version 6 only. In version 7, yes, you just pass a calculation, and not a calculated field, as I suggested.

a2: It doesn't necessarily have to be a global field. I was just thinking of it that way. If you have 350 records corresponding to 350 computers, each record with a corresponding address, then, yes, non-global would be the way to go. Your understanding of globals is correct, it was just my interpretation of the problem that was different.

J

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.