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)

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

(0) ShareShare
ReportReport
Posted on by 72
  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

I have the same question (0)
  • Verified answer
    mnola Profile Picture
    72 on at

    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.

  • olegvi Profile Picture
    809 on at

    Helped me, thank you!

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