Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Macro Problem - Code To Open PO Batch Posting Window Ignored After Executing Login Section Of Macro

Posted on by 150

I am trying to create a macro that logs onto GP Dynamics then posts a PO Purchasing Batch (TRANSACTIONS>PURCHASING>PURCHASING BATCH ENTRY). The logon works fine but then the macro finished without a 'Macro Ran' message or opening the PO Purchasing Batch Window. This is  GP Dynamics 2010 11.00.2106 (SP3). This is the macro as it looks now after trying various solutions  -

# DEXVERSION=11.00.0359.000 2 2

Logging file 'LOGIN.LOG'

CheckActiveWin dictionary 'default' form Login window Login

MoveTo field 'User ID'

TypeTo field 'User ID' , '(userid)'

MoveTo field Password

TypeTo field Password , '(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 # '(company Name).'

MoveTo field 'OK Button'

ClickHit field 'OK Button'

NewActiveWin dictionary 'default' form sheLL window sheLL

CommandExec dictionary 'default' form 'Command_Purchasing' command 'POP_Batch_Entry'

NewActiveWin dictionary 'default' form 'POP_Batch_Entry' window 'POP_Batch_Entry'

TypeTo field 'Batch Number' , 'TEST'

MoveTo field 'Post Button'

ClickHit field 'Post Button'

 

 

*This post is locked for comments

  • Suggested answer
    L Vail Profile Picture
    L Vail 65,271 on at
    Re: Macro Problem - Code To Open PO Batch Posting Window Ignored After Executing Login Section Of Macro

    Hi Phillip,

    I answered this on another post, but here is the copy of the Macro that provides for the Progress windows.

    Kind regards,

    Leslie

    ****************************************************************************************************************

    CommandExec dictionary 'default' form 'Command_Purchasing' command 'POP_Batch_Entry'

    NewActiveWin dictionary 'default' form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    #!BATCH POSTING

    NewActiveWin dictionary 'default' form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    ActivateWindow dictionary 'default' form 'POP_Batch_Entry' window 'POP_Batch_Entry'

     TypeTo field 'Batch Number' , 'FG-130130060004'

     MoveTo field Origin item 0

    ClickHit field Origin item 1 # 'Receivings Trx Entry'

     MoveTo field 'Batch Comment'

     MoveTo field 'Post Button'

     ClickHit field 'Post Button'

    NewActiveWin dictionary 'default'  form 'Progress_Control' window 'Progress_Window'

    NewActiveWin dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    #!BATCH POSTING

    TypeTo field 'Batch Number' , 'FG-130130080007'

     MoveTo field Origin item 0

     ClickHit field Origin item 1 # 'Receivings Trx Entry'

     MoveTo field 'Batch Comment'

     MoveTo field 'Post Button'

     ClickHit field 'Post Button'

    NewActiveWin dictionary 'default'  form 'Progress_Control' window 'Progress_Window'

    NewActiveWin dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    #!CLOSE AND END

    CloseWindow dictionary 'default' form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    NewActiveWin dictionary 'default' form sheLL window sheLL

    CommandExec form BuiLtin command cmdQuitApplication

  • Phillip Derryberry Profile Picture
    Phillip Derryberry 150 on at
    Re: Macro Problem - Code To Open PO Batch Posting Window Ignored After Executing Login Section Of Macro

    Further discovery - if I change the 'POST' to a 'SAVE', the macro works fine. Apparently the progress window for the batch that is posting is what is causing the issue. Any ideas on that one?

  • Phillip Derryberry Profile Picture
    Phillip Derryberry 150 on at
    Re: Macro Problem - Code To Open PO Batch Posting Window Ignored After Executing Login Section Of Macro

    Now another strange issue - when I try to post multiple batches I get 'Window Not Active' and points to the line in the script for the next Post button.  Here's the 'new' script -

    #!LOGON AND LAUNCH GP

    CheckActiveWin dictionary 'default'  form Login window Login

    MoveTo field '(L) SQL_DataSource' item 1  # 'Dynamics GP 2010'

    ClickHit field '(L) SQL_DataSource' item 1  # 'Dynamics GP 2010'

    MoveTo field 'User ID'

    TypeTo field 'User ID' , '<USERID>'

    MoveTo field Password

    TypeTo field Password , '<PASSWORD>'

    MoveTo field 'OK Button'

    ClickHit field 'OK Button'

    NewActiveWin dictionary 'default'  form sheLL window sheLL

    NewActiveWin dictionary 'default'  form sheLL window sheLL

    CommandExec dictionary 'default'  form 'Command_Purchasing' command 'POP_Batch_Entry'

    NewActiveWin dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    #!BATCH POSTING

    NewActiveWin dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    ActivateWindow dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    TypeTo field 'Batch Number' , 'FG-130129104802'

    MoveTo field Origin item 0

    ClickHit field Origin item 1  # 'Receivings Trx Entry'

    MoveTo field 'Batch Comment'

    MoveTo field 'Post Button'

    ClickHit field 'Post Button'

    #!BATCH POSTING

    NewActiveWin dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    ActivateWindow dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    TypeTo field 'Batch Number' , 'PO-130129092826'  <-ERROR POINTS TO THIS LINE

    MoveTo field Origin item 0

    ClickHit field Origin item 1  # 'Receivings Trx Entry'

    MoveTo field 'Batch Comment'

    MoveTo field 'Post Button'

    ClickHit field 'Post Button'

    #!CLOSE AND END

    NewActiveWin dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    CloseWindow dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

    NewActiveWin dictionary 'default'  form sheLL window sheLL

    CommandExec form BuiLtin command cmdQuitApplication

  • Phillip Derryberry Profile Picture
    Phillip Derryberry 150 on at
    Re: Macro Problem - Code To Open PO Batch Posting Window Ignored After Executing Login Section Of Macro

    Thanks. That got it sorted. I knew I was missing something so I must have deleted the 'batch type' entry from the original mac I generated.

  • Verified answer
    L Vail Profile Picture
    L Vail 65,271 on at
    Re: Macro Problem - Code To Open PO Batch Posting Window Ignored After Executing Login Section Of Macro

    Hi Phillip,

    You didn't indicate what kind of batch. This macro will work to post a Purchasing Invoice Entry batch named TEST.

    CheckActiveWin dictionary 'default' form Login window Login

     MoveTo field 'User ID'

     TypeTo field 'User ID' , 'sa'

     MoveTo field Password

     TypeTo field Password , 'pword'

     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 # 'Fabrikam, Inc.'

     MoveTo field 'OK Button'

     ClickHit field 'OK Button'

    NewActiveWin dictionary 'default' form sheLL window sheLL

    CommandExec dictionary 'default' form 'Command_Purchasing' command 'POP_Batch_Entry'

     NewActiveWin dictionary 'default' form 'POP_Batch_Entry' window 'POP_Batch_Entry'

     TypeTo field 'Batch Number' , 'TEST'

     MoveTo field Origin item 0

     ClickHit field Origin item 2  # 'Purchasing Invoice Entry'

     MoveTo field 'Batch Comment'

    ActivateWindow dictionary 'default'  form 'POP_Batch_Entry' window 'POP_Batch_Entry'

     MoveTo field 'Post Button'

     ClickHit field 'Post Button'

    Kind regards,

    Leslie

    PS You can put your logging file info in after you are satisfied.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans