Edit

UserLoggedIn

A script handler you can implement to override standard MoneyWorks behaviour.

Automatically called:  The user has just logged in (network or local) and also when Switch User is used to switch logins when already in a file.

Use for:  You can use this opportunity to load user-specific state. From v7, you get this message even if password protection is not turned on. From v7.1 and later, you can also use this handler to abort the login by returning 0. Older scripts will still work due to the default return value for any handler being 1. The user can be identified by the global variables Initials or UserName.

Return value:  Return FALSE to abort the login (i.e. to prevent the user from logging in).

Example 1 :

on UserLoggedIn
    if UserName = "Rowan" and Day(Today()) >= 6
        Alert("Login denied", "No weekend logins")
        return FALSE // deny login
    endif
end

Example 2 :

on UserLoggedIn
    // record the login time in the UserText field
    ReplaceField ("Login.UserText", "Initials=`" + Initials+"`", "`Last login:" + DateToText(Time(), DateFormShortDateAndTime)+"`")
end