web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Macros Using Todays Date

(0) ShareShare
ReportReport
Posted on by 55

Hello.  I have question regarding the use of Macros.  At my place of work we generate MO's for various different products.  Each MO is always relatively the same.  Its usually a ten step process filling out the MO then generating a lot#.  All of the info is usually static.  So I figured I would set up Macros to record the generating of the MO's.  It works perfectly!  I can fire off an MO with one press instead of manually filing out the MO's.  One small problem though.  It only works for the day I set the macro up.  When filling out the MO I need to put in a start date.  This is where the Macro starts to fail.  The macro will fail the next day because the date that will not match the date that was originally put in (start date).  So my question is:

 

Is their any way to edit the macro save file to auto-update the date or use a command to tell the save file to use the system date?  Any help would be greatly appreciated.

 

ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
  TypeTo field 'Start Date' ,'03242011' (I need this line  to update to the system time)
  MoveTo field 'End Date'
ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
  MoveTo field 'End QTY'
  TypeTo field 'End QTY' , '8012576'
  MoveTo field 'IC_Save_T'
  ClickHit field 'IC_Save_T'
  MoveTo field ICMenu item 0
  ClickHit field ICMenu item 5  # 'Picklist'
NewActiveWin dictionary 'Manufacturing'  form 'MOP_Requirements' window 'MOP_Requirements'

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    L Vail Profile Picture
    65,271 on at

    Hi,

    Macros are great! So glad to see them being used.

    How about letting the macro change the date for you by having it read the user date field? Instead of 'hard coding' the date into the macro, record the key strokes that will copy the user date and then paste it into the 'Start Date' field.  The only trick is to use the Clear command before you use the Paste command. The macro below copies the user date and then pastes it into the SOP Entry Doc date field.

    CommandExec dictionary 'default'  form 'Command_System' command UserDate

    NewActiveWin dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'

     CommandExec form BuiLtin command cmdEditCopy

    ActivateWindow dictionary 'default'  form 'SOP_Entry' window 'SOP_Entry'

     MoveTo field 'Document Date'

     CommandExec form BuiLtin command cmdEditClear

    Kind regards,

    Leslie

  • GP User74 Profile Picture
    55 on at

    Thank you for helping.  Unfortunately, it is not working for me.  Hopefully I am doing something wrong.  I followed your suggestion, but it still is trying to use the date the macro was created on.  Like I said, maybe I am doing something wrong.  My hope was to be able to use the same macro to generate MO's with different lot #'s  For instance:

    MO 101 - Make Red Dye  (generated lot is 8000)

    MO 102 - Make Red Dye  (generated lot is 8010)

    The "Make Red Dye " used the same raw materials, they were just made on different dates.  My hope was to use 1 macro to generate an MO for Red Dye and assign lots.  The problem is the date.  Any Mo created for Red Dye will fail using the one macro because their dates do not match the original macro.  Again, maybe I am doing something wrong.

    NewActiveWin dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

    ActivateWindow dictionary 'default'  form sheLL window sheLL

     CommandExec dictionary 'default'  form 'Command_System' command UserDate

    NewActiveWin dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'

     CommandExec form BuiLtin command cmdEditCopy

    CloseWindow dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'

    NewActiveWin dictionary 'default'  form sheLL window sheLL

    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

     CommandExec form BuiLtin command cmdEditClear

     CommandExec form BuiLtin command cmdEditPaste

     TypeTo field 'Start Date' , '03282011' - (This date is the problem.  It seems to get hard coded into the macro.  I just want the MO to use the date it is generated on))

     MoveTo field 'End QTY'

     TypeTo field 'End QTY' , '8000000'

     MoveTo field 'IC_Save_T'

     ClickHit field 'IC_Save_T'

  • Verified answer
    L Vail Profile Picture
    65,271 on at

    I think you should try getting rid of the line

    TypeTo field 'Start Date' , '03282011'

    It is overwriting your Paste

    Here's what I came up with - I added  - cmdEditSelectAll - just to be sure, seems like I always add that to the sequence:

    NewActiveWin dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

    ActivateWindow dictionary 'default'  form sheLL window sheLL

     CommandExec dictionary 'default'  form 'Command_System' command UserDate

    NewActiveWin dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'

     CommandExec form BuiLtin command cmdEditSelectAll

     CommandExec form BuiLtin command cmdEditCopy

    CloseWindow dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'

    NewActiveWin dictionary 'default'  form sheLL window sheLL

    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'

    MoveTo field 'Start Date' <--- I didn't see where your macro ever moved into the field it was going to copy the date into.

     CommandExec form BuiLtin command cmdEditSelectAll

     CommandExec form BuiLtin command cmdEditClear

     CommandExec form BuiLtin command cmdEditPaste

    MoveTo field 'End QTY'

    TypeTo field 'End QTY' , '8000000'

    MoveTo field 'IC_Save_T'

    ClickHit field 'IC_Save_T'

    I don't have Mfg installed on the machine I'm working on, but the concept is the same. It really does work. Let me know if I can help. The macro language is one of those unsung heroes of Dynamics 

    Kind regards,

    Leslie

  • GP User74 Profile Picture
    55 on at

    Thank you very much for taking the time out to help me with this issue.  I really aprreciate it.  This is driving me nuts!  i cannot get this to work.  I have tried everything you suggested.  It always goes back too no matter how I copy/paste fom the user date field that date gets hard coded into the macro.  If I delete the "Type to field"start date" line then the macro will fail.  It seems to always look for the orignal date put in.  If I leave the line in and I try and run the macro at a different date the MO fails, I get the "date has passed" message and the macro stops before completing.  It seems the way I have this macro set up, It needs to see a date in the date field.  Once one is pasted to it, it hard codes that date.  Its frustrating for me because it works for you, so I know it will work.  I am just doing something wrong.  Something is getting lost in translation from you to me.  Again thanks for all your help.  If you have any more suggestion I am all ears.  I want/need this to work.  This would make my life SO much easier.  Here is a screenshot of how I make an MO.  Maybe this will paint a better picture of what is happening.

    # DEXVERSION=10.0.263.0 2 2
      CommandExec dictionary 'Manufacturing'  form 'Command_MFG' command 'WO_Entry'
    NewActiveWin dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
      MoveTo field 'Item Number'
      TypeTo field 'Item Number' , 'Red Dye'
      MoveTo field 'BOM Cat' item 1  # 'MFG BOM'
      MoveTo field 'Manufacture Order Status' item 1  # 'Quote/Estimate'
      ClickHit field 'Manufacture Order Status' item 2  # 'Open'
      MoveTo field 'Draw From Site'
      TypeTo field 'Draw From Site' , 'Site 1'
      MoveTo field 'Lookup Button 8'
      ClickHit field 'Lookup Button 8'
    NewActiveWin dictionary 'SmartList'  form 'IV_Item_Location_Lookup' window 'IV_Item_Location_Lookup'
    ActivateWindow dictionary 'SmartList'  form 'IV_Item_Location_Lookup' window 'IV_Item_Location_Lookup'
    # Key 1: 'Red Dye', '2', 'Site 1'
      MoveTo line 2 browsewin 'IV_Item_Locations_Scroll'
      MoveTo field 'Select Button'
      ClickHit field 'Select Button'
    NewActiveWin dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
      TypeTo field 'Start Date' , '03292011'
      MoveTo field 'End Date'
      MoveTo field 'End QTY'
      TypeTo field 'End QTY' , '10000000'
      MoveTo field 'Start QTY'
    ActivateWindow dictionary 'default'  form sheLL window sheLL
      CommandExec dictionary 'default'  form 'Command_System' command UserDate
    NewActiveWin dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'
      CommandExec form BuiLtin command cmdEditSelectAll
      CommandExec form BuiLtin command cmdEditCopy
    CloseWindow dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'
    NewActiveWin dictionary 'default'  form sheLL window sheLL
    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
      MoveTo field 'Start Date'
      CommandExec form BuiLtin command cmdEditClear
      CommandExec form BuiLtin command cmdEditPaste
      MoveTo field '(L) schedule_work_order'
      ClickHit field '(L) schedule_work_order'

     

     

    Please dont give up on me.  I know I can get this to work, eventually.

  • GP User74 Profile Picture
    55 on at

    I think I got it!!!  Making progress....Stay tuned.

  • GP User74 Profile Picture
    55 on at

    L Vail you are a god amongst mortals.  It worked!  I owe you a coffee :).  You are certainly deserving of your MVP status.  Again, thank you for taking the time to help me work this out.  Everything you said was indeed correct.  It was just a matter of getting everything into the right place.  Sometimes i am a little slow on the uptake. The key was the "cmdEditSelectAll "  along with deleting the " MoveTo field 'Start Date'.  I tested and can verify this will not work without using the cmdEditSelectAll command right before the clear command > paste command into the date field.  It has to be in there.  I then had to go in and delete the "Moveto field "Start date" line.  This is the arrangement that finally worked:

    # DEXVERSION=10.0.263.0 2 2
      CommandExec dictionary 'Manufacturing'  form 'Command_MFG' command 'WO_Entry'
    NewActiveWin dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
      MoveTo field 'Item Number'
      TypeTo field 'Item Number' , 'Red Dye'
      MoveTo field 'BOM Cat' item 1  # 'MFG BOM'
      MoveTo field 'Manufacture Order Status' item 1  # 'Quote/Estimate'
      ClickHit field 'Manufacture Order Status' item 2  # 'Open'
      MoveTo field 'Draw From Site'
      TypeTo field 'Draw From Site' , 'Site 1'
      MoveTo field 'Post To Site'
      TypeTo field 'Post To Site' , 'Site 2'
      MoveTo field 'Start Date'
    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
      MoveTo field 'End QTY'
      TypeTo field 'End QTY' , '10000000'
      MoveTo field 'Start QTY'
    ActivateWindow dictionary 'default'  form sheLL window sheLL
      CommandExec dictionary 'default'  form 'Command_System' command UserDate
    NewActiveWin dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'
      CommandExec form BuiLtin command cmdEditSelectAll
      CommandExec form BuiLtin command cmdEditCopy
    ActivateWindow dictionary 'Manufacturing'  form 'WO_Entry' window 'WO_Entry'
      MoveTo field 'Start Date'
      CommandExec form BuiLtin command cmdEditSelectAll
      CommandExec form BuiLtin command cmdEditClear
      CommandExec form BuiLtin command cmdEditPaste
    MoveTo field 'IC_Save_T'
      ClickHit field 'IC_Save_T'

    Again, thank you so much!  I hope this helps anyone else trying to use macros in this way.  I am now off to create a couple hundred macros....

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans