Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modify Macro to use system date
#1
I have a macro that is used to create a transaction in a ERP system. The ERP system has a field which requires a unique value. I want to modify my macro so that this field is automatically populated with the system date......here is my entire macro (I have marked out the exact field that i need to replace with system date)

# DEXVERSION=10.0.324.0 2 2
CheckActiveWin dictionary 'default' form 'PM_Transaction_Entry' window 'PM_Transaction_Entry'
MoveTo field 'Transaction Description'
TypeTo field 'Transaction Description' , 'testing macro'
MoveTo field 'Batch Number'
MoveTo field 'Document Date'
MoveTo field 'Vendor ID'
TypeTo field 'Vendor ID' , 'DYNAMICSSOUR'
MoveTo field 'Vendor Address Code - Primary'
MoveTo field 'Vendor Address Code - Remit To'
MoveTo field 'Payment Terms ID'
MoveTo field 'Document Number'
TypeTo field 'Document Number' , '1123'
-----------in this document number field I need to replace '1123' with system/user date-----------Is this possible?----------
MoveTo field 'Purchase Order Number'
MoveTo field 'Shipping Method'
MoveTo field 'Tax Schedule ID'
MoveTo field 'Purchases Amount'
TypeTo field 'Purchases Amount' , '1111111'
MoveTo field 'Trade Discount Amount'
MoveTo field 'Distributions Button'
ClickHit field 'Distributions Button'
NewActiveWin dictionary 'default' form 'PM_Transaction_Entry_Distribution' window 'PM_Transaction_Entry_Distribution'
MoveTo field 'OK Button'
ClickHit field 'OK Button'
NewActiveWin dictionary 'default' form 'PM_Transaction_Entry' window 'PM_Transaction_Entry'
MenuSelect title Additional entry 'Sprint Bill Breakout'
ActivateWindow dictionary 'Extender' form 'PT_UD_Detail_Window_1' window 'User Defined Window'
# Key 1:
MoveTo line 1 scrollwin 'Scrolling_Window' field 'User Defined Currency'[1]
# Key 1: '', '', '0'
TypeTo line 1 scrollwin 'Scrolling_Window' field 'User Defined Currency'[1] , '15000'
# Key 1: '', '', '0'
MoveTo line 1 scrollwin 'Scrolling_Window' field 'User Defined List'[2] item 0
# Key 1: '', '', '0'
ClickHit line 1 scrollwin 'Scrolling_Window' field 'User Defined List'[2] item 1 # 'EMS Gillette NY'
# Key 1: '', '', '0'
MoveTo line 1 scrollwin 'Scrolling_Window' field '(L) User Defined Checkboxes'[3] # 'FALSE'
# Key 1: '', '', '0'
ClickHit line 1 scrollwin 'Scrolling_Window' field '(L) User Defined Checkboxes'[3] # 'TRUE'
TransLinePrepare scrollwin 'Scrolling_Window'
# Key 1:
MoveTo line 2 scrollwin 'Scrolling_Window' field 'User Defined Currency'[1]
# Key 1: '', '', '0'
TypeTo line 2 scrollwin 'Scrolling_Window' field 'User Defined Currency'[1] , '12500'
# Key 1: '', '', '0'
MoveTo line 2 scrollwin 'Scrolling_Window' field 'User Defined List'[2] item 0
# Key 1: '', '', '0'
ClickHit line 2 scrollwin 'Scrolling_Window' field 'User Defined List'[2] item 2 # 'Noramco 2729 13th Av Hibbing MN'
# Key 1: '', '', '0'
MoveTo line 2 scrollwin 'Scrolling_Window' field '(L) User Defined Checkboxes'[3] # 'FALSE'
# Key 1: '', '', '0'
ClickHit line 2 scrollwin 'Scrolling_Window' field '(L) User Defined Checkboxes'[3] # 'TRUE'
MoveTo field 'OK Button'
ClickHit field 'OK Button'
NewActiveWin dictionary 'default' form 'PM_Transaction_Entry' window 'PM_Transaction_Entry'
#2
You code doesn't look like Quick Macros code?

There are many ways in QM to work with time formatted strings. Here would be an example of the most precise format for your application. It outputs the time right up to the millisecond. Pretty much guarantees a unique number for every transaction:
Code:
Copy      Help
str s
SYSTEMTIME st
GetLocalTime &st
s.format("%02i%02i%02i%02i%02i%02i%03i" st.wYear st.wMonth st.wDay st.wHour st.wMinute st.wSecond st.wMilliseconds)
out s


Forum Jump:


Users browsing this thread: 1 Guest(s)