There are a number of ways to do this. The easiest for a new developer to understand might be this.
At the top of the script add these lines:
If [ $AlreadyRan = 1]
Set Variable [$AlreadyRan; 1 ]
What this does is "turn off" the script trigger after the first go. When you close your log window and the on layout enter triggers it runs the script again but since the variable is set it'll exit.
All that said, you may want to take a good look at your access logging before you get too far down the road.
Nick's suggestion should work fine, but you might want to think about another approach. One issue with the new window/close window will be a screen pop or flash that could be annoying. This will happen even if you open the new window in negative space (something like -30,000 top and left).
An alternative would be to create a relationship to your log table that allows the creation of records. You'd need to create two unstored calcs (Account Name and TimeStamp) in each table. Then create a relationship to your log table, using both of these fields, than allows the creation of records. This way you could simply do a set field (perhaps the layout name?) in the log table to create a log entry. There would be no screen pop, as everything would happen from the same context. As the timestamp field is unstored it would have a different value every time, creating a new record at each set field.
Thanks for the ideas.
I haven't yet had time to try it out but will try to implement what you have suggested.
FileMakerStandards.org has a best practice for dealing with this sort of thing. It's vaguely along similar lines to Nick's suggestion, but more systematized. You might edit your script like so:
If [not TriggersAreActive]
Exit Script [Result:True]
Set Variable [$~; TriggersDisable]
New Window [...]
Go to Layout [...]
Close Window [...]
Set Variable [$~; TriggersEnable]
This way, when the script is triggered the second time, it will check global variable flags controlled by the custom functions and decide to not run.