http://automation-beyond.com/2009/11/12/ms-dynamics-great-plains-macros/
After opening GP but before logging in, use Alt-F8 to record macro, sign in, and exit GP. Edit the new macro file to clean it up. You also should insert a "Logging File" command to avoid the 'OK' at the end of the macro. Here's an example from GP8:
#AutoTestLogin.mac
# DEXVERSION=DEX 8.00
#*** Insert the following line
Logging file ':c:AutoTestLogin.log'
CheckActiveWin dictionary 'default' form Login window Login
MoveTo field '(L) SQL_DataSource' item 5 # 'TestCorp'
ClickHit field '(L) SQL_DataSource' item 5 # 'TestCorp'
MoveTo field 'User ID'
TypeTo field 'User ID' , 'autotestuser'
MoveTo field Password
TypeTo field Password , 'autotestpw'
MoveTo field 'OK Button'
ClickHit field 'OK Button'
NewActiveWin dictionary 'default' form 'Switch Company' window 'Switch Company'
ClickHit field '(L) Company Names' item 1 # 'TestCorp, Inc.'
MoveTo field 'OK Button'
ClickHit field 'OK Button'