Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Launching GP with a Macro File using Scheduler (SQL Agent and/or Windows Task Scheduler) no longer works in new Windows 2016 Environment

Posted on by 70
  1. Have a Dynamics GP macro that automatically logs into GP, runs a task and then closes GP. 
  2. We have a scheduled job inside SQL Server Agent that runs a command similar to the one below.
      1. "C:\Program Files (x86)\Microsoft Dynamics\GP2013\Dynamics.exe" "C:\Program Files (x86)\Microsoft Dynamics\GP2013\Dynamics.set"  "C:\Macros\GPMacro.mac"

  3. This macro functions without issue in a Windows 2008 R2/SQL 2008 R2/GP 2013 R2 environment.  
  4. When the same macro retrofitted for GP 2016/Windows 2016/SQL 2016 Server environment, it fails because it does not see the GP Logon Window as the active window (see Macro Log Results below). 
  5. The Macro does run if logged onto the Windows Desktop and then GPMacro.bat file, so do not believe the issue is a syntax issue.

Wondering if there are any special settings or other macro commands that can be inserted to help resolve matters?

Macro Log Results

===============================================================================
:C:Macros/GPMacro.mac                             Started   06/13/2018 15:36:05
:C:Macros/GPMacro.mac                             Aborted   06/13/2018 15:36:05
:C:Macros/GPMacro.mac                             Elapsed                  0:05      Last Line    3
Error:        Field on window is inactive or disabled.
Last Line:    3
Line:           MoveTo field 'User ID'
Location:     dictionary 'Microsoft Dynamics GP'  form Login  window Login  field

Window Contents:
   'User ID': "GPUSERID"
   Password: "XXXXXXXX"
   D:'(L) RememberMe': "FALSE"
   '(L) SQL_DataSource': "1"
      Dynamics GP 2016 =
   L:'(L) AuthenticationType': "1"
      Directory Account
      SQL Server Account =
   'OK Button': Button
   'Cancel Button': Button
   L:LoginPicture: "1"
   L:'(L) Status': "Version : 16.00.0675"
   WindowHelp: Button

Front Window:
   'User ID': "GPUSERID"
   Password: "XXXXXXXX"
   D:'(L) RememberMe': "FALSE"
   '(L) SQL_DataSource': "1"
      Dynamics GP 2016 =
   L:'(L) AuthenticationType': "1"
      Directory Account
      SQL Server Account =
   'OK Button': Button
   'Cancel Button': Button
   L:LoginPicture: "1"
   L:'(L) Status': "Version : 16.00.0675"
   WindowHelp: Button

Sample Macro that logs into GP and then out.

Logging file 'c:\macros\macro.log'
CheckActiveWin dictionary 'default'  form Login window Login
  MoveTo field 'User ID'
  TypeTo field 'User ID' , 'GPUSERID'
  MoveTo field Password
  TypeTo field Password , 'GPUSER Password'
  MoveTo field 'OK Button'
  ClickHit field 'OK Button'
NewActiveWin dictionary 'default'  form sheLL window sheLL
NewActiveWin dictionary 'default'  form 'Switch Company' window 'Switch Company'
  ClickHit field '(L) Company Names' item 1 
  MoveTo field 'OK Button'
  ClickHit field 'OK Button'
NewActiveWin dictionary 'default'  form sheLL window sheLL
ActivateWindow dictionary 'default'  form sheLL window sheLL
  CommandExec dictionary 'default'  form 'Command_System' command CloseAllWindows
NewActiveWin dictionary 'default'  form sheLL window sheLL
CommandExec form BuiLtin command cmdQuitApplication

*This post is locked for comments

  • olegvi Profile Picture
    olegvi 769 on at
    RE: Launching GP with a Macro File using Scheduler (SQL Agent and/or Windows Task Scheduler) no longer works in new Windows 2016 Environment

    Helped me, thank you!

  • Verified answer
    mnola Profile Picture
    mnola 70 on at
    RE: Launching GP with a Macro File using Scheduler (SQL Agent and/or Windows Task Scheduler) no longer works in new Windows 2016 Environment

    Never mind, solved my issue by inserting "ActivateWindow dictionary 'default' form Login window Login" right after "CheckActiveWin dictionary 'default'  form Login window Login ".  Funny thing that this wasn't an issue in Windows 2008R2/SQL 2008R2, but is an issue in Windows 2016/SQL 2016.

    Hope this helps someone else runs into the same problem.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans