SBX - Search With Button

SBX - Forum Post Title

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

Microsoft Dynamics GP Forum

mnola asked a question on 13 Jun 2018 2:47 PM
My Badges

Question Status

Verified
  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

Reply
mnola responded on 13 Jun 2018 5:20 PM
My Badges
Verified Answer

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.

Reply
mnola responded on 13 Jun 2018 5:20 PM
My Badges
Verified Answer

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.

Reply

SBX - Two Col Forum

SBX - Migrated JS