Dynamics GP Macro Reference

This post is based on the post by Mark Polino, that pointed out some work by Kevin Gross, a Macro reference for GP Macros that was located here (May 2015 link now dead, glad I preserved it!):
http://www.box.net/shared/nbdzqzkt29

The Mark Polino’s post was here:
DynAcctPost
http://msdynamicsgp.blogspot.co.uk/2009/09/dynamics-gp-macro-commands.html

Kevin’s text has been extracted below to share with the community and for better Google indexing as it previously was not well indexed by search engines.

Window Operations

Window Operations are use to manipulate the entire window. The last part of the line is usually the same. …dictionary ‘default’ (This means which dictionary to look at. ‘default’ is the Dynamics dictionary. If you are working with third party dictionaries, that will change. …form Login window Login are the Dexterity names for the window that you are working with.

· NewActiveWin—this is used when a window is opened from a button or a menu operation.

o NewActiveWin dictionary 'default' form Login window Login

· ActivateWindow—This is used when a window is in the background and it needs to be brought to the foreground.

o ActivateWindow dictionary 'default' form Login window Login

· CloseWindow—this will close the window if the window doesn’t close automatically by clicking Ok or Save

o CloseWindow dictionary ‘default’ form Login window Login

· WindowMove—this will move the window around the screen. You would normally have a lot of these in your macro. If for some reason you do end up recording a move in your macro, I would edit the macro and delete these lines. Window Moves do not always play back as they should. One of the positive things about the Dexterity Macro system, is that it doesn’t care where the window is at, as long as it is active.

o WindowMove dictionary ‘default’ form Login window Login pointh 3 pointv 23

· CommandExec—This command opens the window. The movements through the menu system or choosing from the home page are not recorded. The macro will just record what window and form were opened.

o CommandExec dictionary 'default' form Login window Login

Field Operations

Before you can type into a field your focus must be in the field. This can happen either by a focus change via code (opening the window and the focus goes into the first field) or by the user tabbing through the window. In a macro you will usually see two lines for each field entry. It is always better to type in a value rather than selecting it from a lookup. Lookup values can change and if they change then you need to edit your macro.

· MoveTo—this will force the focus into the field listed. Any field name that is more than one work needs to be contained in single quotes

o MoveTo field 'User ID’

· TypeTo—This will type the value into the field listed.

o TypeTo field 'User ID' , 'sa'

· ContTypeTo—If the text being entered is longer, it may be spread across multiple lines in the macro. If you want you can take the text in the quote and put on the main TypeTo line.

o TypeTo field 'Account Description' , 'Fargo Branch Rental Division Rates accou'

o ContTypeTo field 'Account Description' , 'nt 1'

o So the above two lines could be made into

§ TypeTo field 'Account Description' , 'Branch Rental Division Rates account 1'

· Typing of numbers—When typing of numbers you will never see the decimal point recorded into the macro. Examples—

o $12.45 will be recorded as

§ TypeTo field ‘Currency’ , ‘1245’

o 5.3561% will be recorded as

§ TypeTo field ‘Percent’ , ‘53561’

§ Trailing zeros would have to be entered as needed

· Typing of Dates—When typing dates there will not be slashes recorded in the macro

o TypeTo field ‘Date’ , ‘092309’

· Typing of Times—When type times there will be no colon recorded in the macro

o TypeTo field ‘Time’, ‘0800’

· Buttons are fields. So in your macro you will see the following to click on the Select Button

o MoveTo field 'Select Button'

o ClickHit field 'Select Button'

Account Numbers

When working with account numbers and macros, they record just a bit different than other fields. Following is a typical entry for accounts:

TypeTo field 'Account Number CS':'Account_Segment_Pool1' , '1000'

MoveTo field 'Account Number CS':'Account_Segment_Pool2'

TypeTo field 'Account Number CS':'Account_Segment_Pool2' , '1000'

MoveTo field 'Account Number CS':'Account_Segment_Pool3'

TypeTo field 'Account Number CS':'Account_Segment_Pool3' , '0000'

MoveTo field 'Account Number CS':'Account_Segment_Pool4'

TypeTo field 'Account Number CS':'Account_Segment_Pool4' , '1100'

MoveTo field 'Account Number CS':'Account_Segment_Pool5'

TypeTo field 'Account Number CS':'Account_Segment_Pool5' , '0000'

Notice that each segment is a separate field.

Scrolling Window Operations

Data Entry

Below is a sample of the Receivables Transaction Distribution window:

TransLinePrepare scrollwin 'Sales_Distributions_Accounts_Scroll'

/# Key 1:

MoveTo line 2 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool1'

/# Key 1: '', '3', '1', 'SALES0001', '32768'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool1'

/# Key 1: '', '0', '0', '', '0'

TypeTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool1' , '1000'

/# Key 1: '', '0', '0', '', '0'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool2'

/# Key 1: '', '0', '0', '', '0'

TypeTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool2' , '1000'

/# Key 1: '', '0', '0', '', '0'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool3'

/# Key 1: '', '0', '0', '', '0'

TypeTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool3' , '0000'

/# Key 1: '', '0', '0', '', '0'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool4'

/# Key 1: '', '0', '0', '', '0'

TypeTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool4' , '1100'

/# Key 1: '', '0', '0', '', '0'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool5'

/# Key 1: '', '0', '0', '', '0'

TypeTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field '(L) Distribution Account':'Account_Segment_Pool5' , '0000'

/# Key 1: '', '0', '0', '', '0'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field 'Distribution Type' item 0

/# Key 1: '', '0', '0', '', '0'

ClickHit line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field 'Distribution Type' item 9 # 'SALES'

/# Key 1: '', '0', '0', '', '0'

ClickHit line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field 'Distribution Type' item 9 # 'SALES'

/# Key 1: '', '0', '0', '', '0'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field 'Debit Amount'

/# Key 1: '', '0', '0', '', '0'

MoveTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field 'Credit Amount'

/# Key 1: '', '0', '0', '', '0'

TypeTo line 7 scrollwin 'Sales_Distributions_Accounts_Scroll' field 'Credit Amount' , '100000'

TransLinePrepare scrollwin 'Sales_Distributions_Accounts_Scroll'

· Any of the lines that start with the # are not needed. They can be removed. However I usually leave them in there because it can help with debugging later on if you need too.

· You must keep track of what line you are working on in the scrolling window. Notice that all the MoveTo and TypeTo reference what line you are on.

· The line numbers that are entered into the macro are the line number that is visible on scrolling window. For example if the scrolling window is showing 8 lines and you add more than 8 lines you will always be typing on line 8 once you get past the 8th line of data entry.

· If you have expanded the scrolling window, even though 1 data entry line may be displayed on 2 lines, as long as you are working with that data entry line, you will be typing on line 1

· When you move lines, you will see ‘TransLinePrepare’.

Movement in the window

· Don’t click and drag the vertical scroll bar. This does not record

· ScrollByPage—This would be used to scroll by page. Recommended against using due to the fact that different users may be displaying different number of lines in the scrolling window.

· ScrollByLine—This is the same as clicking the arrow once. This is a better way of moving in a scrolling window if you must move around.

· Selecting a value out of the lookup window will show like the following

o MoveTo field '(L) Doubleclick'

o ClickHit field '(L) Doubleclick'

o Doubleclick may change by window depending on how the developer followed the naming conventions. You will not see the button called Doubleclick on the window, but it is there.

Other tidbits

· #--anything following this on the line will be a comment. This is a great way to leave others (and yourself) reminders as to what you did.

· All macro commands are case sensitive.

· Avoid selecting from a lookup window. For example if you are selecting customer ‘Boston Market’ and it is the fifth line in the lookup window it will be recorded as selecting line 5. Now if you create a new customer called ‘Alberts Chicken’, Boston Market is moved to line 6 so the macro would be selecting the wrong customer. So the best way is to type the value into the field.

· If you want the macro to close GP, then you need to select it through the menu. GP does not recognize the Red X close button

·