Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6846 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I need to get the username when a record is created or modified. The built in method of auto-entering this data won't work for me because of a couple issues. First, users forget to update the Application Preferences and we have some users accessing FMP through Terminal Services so we get duplicate usernames. Is there another method of getting an OS username into FMP when a record is created or modified?

Posted

Yep: a Windows logon script (ask your network admin guy about this) that changes the section in the registry where FM stores the username:

HKEY_CURRENT_USERSoftwareFileMakerFileMaker Pro6.0PreferencesUser Name

Make the logon script write the current Windows user name there.

It needs to be a Windows logon script because the data needs to be written before FM launches. If you changes it after FM is launched, it will have no effect.

Posted

Thanks for the help. I don't actually have a Network Admin to help me. I've done some looking around and can't seem to find exactly what I'm looking for. Do you happen to have an example of a logon script I can use? Thanks in advance.

Posted

Explaining how to use Windows Logon scripts would take too much time and it depends on your setup. So I suggest you look at the help section of your Windows server and do a google on the subject.

Here's a generic script you can use. It makes sure that the TCP/IP protocol is active for FileMaker and writes the Windows user name to the FileMaker preferences:

' ===================================================

'

' Script created by Wim Decorte - Connecting Data.

' 20050114

' All rights reserved.

' © Connecting Data - Wim Decorte

'

' This is a generic Windows Logon Script that sets

' the FileMaker network protocol to TCP/IP

' and writes the current Windows User name to the

' FileMaker preferences section.

'

' ===================================================

'

Option Explicit

'

' Objects

' -----------

Dim wshshell 'Windows Script Host Shell

Dim oNetwork 'Network Object

'

' Registry key to read/write

' ---------------------------

Dim Key

'

' Some FileMaker preference Key & value variables

'-------------------------------------------------

Dim keyNetworkProtocol

Dim valueNetworkProtocol

Dim keyUserName

Dim valueUserName

Dim FMversion

'

' Initialize Objects

'-----------------------

Set wshshell = CreateObject("WScript.shell")

Set oNetwork = WScript.CreateObject("WScript.Network")

'

' Initialize variables

'----------------------

FMversion = "6.0" ' change the version here to make this script work with other versions...

valueNetworkProtocol = "Fmtcp32.net"

valueUserName = oNetwork.UserName

Key = "HKEY_CURRENT_USERSoftwareFileMakerFileMaker Pro" & FMversion & "Preferences"

'

' Full syntax to Each preference

'--------------------------------

keyNetworkProtocol = Key & "Network Protocol"

keyUserName = Key & "User Name"

'

' write to the registry

'-----------------------

wshshell.RegWrite keyNetworkProtocol, valueNetworkProtocol, "REG_SZ"

wshshell.RegWrite keyUserName, valueUserName, "REG_SZ"

'

' release objects and quit this script

'--------------------------------------

Set wshshell = Nothing

Set oNetwork = Nothing

WScript.quit

'

' End of code

  • 1 month later...

This topic is 6846 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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