You would need to create a "Re-Login" script on the remote file that will login with the credentials you wish to use and call that script.
My suggestion is you set the remote file to auto-open as Guest with no accesss to much of anything, and then call the "Re-Login" script from your Opne File script and pass it the credentials you want. From there, you can call any other script (or modify the same "Re-Login" script) to navigate to the layout you want.
Each FileMaker file needs to have its own security settings, which you set up using the File menu > Manage Security...
However, if you set up the same accounts in each file (though possibly with different privileges, that's up to you), when one FileMaker file references another one, the credentials from the calling file will automatically be used.
For example, if I'm logged into database file A as user "mbaum", and some kind of reference is made to file B, then if file B includes the same account/password credentials for "mbaum" in its security setup, file B will be opened automatically without presenting another login dialog.
Next, it sounds like you want the user to be presented with a layout in File B. In that case, you want to create a script in File B with these steps:
Go To Layout (layout-you-want)
Select Window (current window)
Then in your Open Window script, include the "Perform Script" step, changing that step's options to call the script in File B.
All that said, why exactly do you want your Open Window script to switch the user over to a layout in another file? Are you trying to discourage people from accessing File A -- maybe File A is for data, and File B is for interface? Your answer should help other people chime in with more advice.
Hope this helps --
Forgot to specify, you have to call that remote "Re-Login" script from your "Open File" script
I would highly recommended studying the way FM handles permissions before programming something on your own to switch permission sets in between files. Especially look at the functions that expose security information Get ( AccountPrivelegeSetName ) etc and the script steps that can be used to manipulate security settings. Also look at how to pass values between scripts. You might spend days trying to program something that FM does all by itself. Start with the FM training series.
This helped a lot. I'm still having to log on as guest to the remote database, even though both databases are set up with the same guest account read only privilege, but it's much closer to what I need, so thank you very much!
Are you saying Ingrid should store user credentials in a script?
Storing user credentials in a script is ofc a bad idea.
GMImage.GetPixelColor and GMImage.SetPixelColor.
With the aid of these 2 and some other functions, you can create a picture and store it into a container.
The picture would have 4 pixel rows.
The first row is the RGB chooser for the account name. Every pixel, when decoded into its RGB, will give a value like 102 or 211 or 000.
0 = Red, 1 = Green, 2 = Blue.
Once you've read all the pixels (let's say 10 pixels) you get something like 2101201102220022110101020202022112022.
This becomes the key to read the second row of pixels. For every pixel of the second row, you read its RGB value, and the key above tells you which value is the significant one, for example when the 4th RGB pixel has color (212 68 178) and the key says that at place 4 there's a 1, the only value that is important is the G value, i.e. 68.
You calculate CHAR(68), it evaluates to D, you add that to the account name. Rinse and repeat. At the end you got the full account name.
Do it again with the password. (lines 3 and 4 in your image).
All you need is
1) bake a Filemaker database that lets you input 2 items, accountName and Password.
It will generate a 4 pixel tall image, with lines 1 and 3 being random. Depending on that, even 2 out of the 3 parameters of the 2 and 4th line can be random.
Line 1 and 3 can be anything, from random to something you input, to Filter(SetPrecision(Log(Pi);500);"012")
You can put that into a file to be read or in a global set while the file is locally opened.
2) have a script that reads the RGBs of the pixels, pumps them to a custom function, stores the returned username and password in 2 $vars and issues the Open URL step with "FMP://" & $acc & ":" & $pwd & "@" & $ip etc. Or even does not store them at all, just has a function call instead.
Call me sick. I probably deserve it
In the file you want to open and go to a layout, create a script to go to that layout etc., if you haven't, and note the name.
In your file, do a Perform script aimed at that remote file. If you don't know how to do that, ask.
With the matching passwords as was mentioned by Mark, this perform script will do what you want using existing scripts in that file. If no Matching Account Name, then you will be asked for the details.