3 of 3 people found this helpful
I have written a short line of code as a custom html in the web viewer such that when the link present in the web viewer is clicked it runs a particular script in the file with a parameter. ... each time the link is clicked filemaker reopens the file that i am trying to work with and asks me to reauthenticate and then runs the script. The functionality i want is for the link to be clicked in the web viewer and the script to run in the same (currently open) file.
That's right. The fact that you have logged in via FMPro is irrelevant. The call to run the script is coming from an unknown user via the web. Your file has authentication settings and it wants to know who is waking it up and asking it to do some work. You want to pass a user name and password along with the URL. Check Help to see how to do that. You might consider making a special user account just to run the script.
The second window appears because you are sharing the file and is an issue that I have come across and not found a solution too other than hosting the file on FileMaker Server.
What I believe is happening is when you click the web link you then access the same database over the fmapp security privilege which FileMaker will treat as a new instance of the database resulting in a new window.
Look at the script menu from the new window, does it have an IP? Then look at the scripts window from the original window.
I'm pretty sure one will have an IP (the shared IP) and the other will not.
You don't have this issue with FMGo becuase you can explicitly say use this file by this "fmp://~/DatabaseName.fmp12" but this doesn't work on the FileMaker Pro.
You may be able to have an OnOpen script trigger that determines if being called from fmapp and handle the window appropriately.