[Return to contents]
Last updated: before December, 1998
This script will search the win.ini for an Approach User Section, read the value of the next line and place it into a variable field. You can then use this variable field in new record creation formula to tag who input the record.
Sub UserID 'Written by Jerry Sikes , 1997 '(C) Copyright 1997 by Jerry Sikes ' 'Permission is granted to freely copy this script in electronic form, 'or to print for personal use. It may be use in any Approach database, 'but may not be distributed for profit either by itself or as part of 'a collection or database. ' 'Disclaimer: This script is provided as is without any express or 'implied warranties. The author assumes no responsibility for errors or 'omissions, or for damages resulting from the use of the information contained 'herein, or your own version containing your desires for the usage of the 'script. 'Add a section to a workstations win.ini '[Approach User] 'user name 'create a variable field named id_var (type:text) 'make sure this field is present on the start up Form 'run this script via the OPEN macro, which will self execute at apr start. Dim fileName As String, fileNum As Integer Dim id As String, Label As String, MyFlag As String fileNum% = Freefile() 'reserve the next file open number fileName$ = "c:\windows\win.ini" 'name the target MyFlag = "false" 'set the flag Open fileName$ For Input As fileNum% 'open the file for read only Do Until Eof(fileNum%) 'check every line Line Input #fileNum%, Label 'input current line If MyFlag = "true" Then 'test MyFlag id = Label 'Set id to one line below the True flag operation MyFlag = "false" 'reset MyFlag End If If Label = "[Approach User]" Then 'Looking for section MyFlag= "true" 'found it End If Loop currentview.body.id_var.text = id 'set variable field with supplied name Close fileNum% ' close the win.ini End Sub