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 NAV (Archived)

Microsoft Dynamics Navision 2009 R2 problem.

(0) ShareShare
ReportReport
Posted on by

Hello to you all !

My problem is the following. I want to do a workaround for autoimporting FOB-s in Navision using a codeunit with WShell.SendKeys. All good 'till now. So I am able to open the Object Designer by the combination of Shift+F12. After that, any other combination of Keys with the WShell.SendKeys focuses on the Main page of Navision and not on the Object Designer. I need to change the focus of the SendKeys on the Object Designer so that I may be able to do a filter and import the FOB. I don't know if you get me right. I'm not an expert in Navision and I would very appreciate any idea or help. ¡Thank you so much! This is the code I use in the codeunit:

"

//VarRetVal:=0;
//VarRetVal:=SHELL('C:\Program Files (x86)\Microsoft Dynamics NAV\60\Classic\finsql.exe');
WaitForKeys := TRUE;
CLEAR(WShell);
IF ISCLEAR(WShell) THEN
IF NOT CREATE(WShell) THEN EXIT;
//WShell.AppActivate(VarRetVal);
WShell.Popup('Hasta aqui llega Gabi');
WShell.SendKeys('+{F12}',WaitForKeys); // Object Designer

WShell.Popup('After opening the Object Designer it doesn't go forward as I explained before');
//VarRetVal:=VARIABLEACTIVE(WShell.AppActivate());
//WShell.AppActivate(VarRetVal);
FOR I:=0 TO 10 DO BEGIN
SLEEP(250);
I+=1;
END;

CLEAR(WShell2);
IF ISCLEAR(WShell2) THEN
IF NOT CREATE(WShell2) THEN EXIT;
WShell2.SendKeys('%{a}',WaitForKeys);
//WShell.SendKeys('%{a}',WaitForKeys); // Object Designer
//WShell.SendKeys('+^{F7}',WaitForKeys); // clear filters
//WShell.SendKeys('{LEFT 12}',WaitForKeys);
//WShell.SendKeys('{RIGHT 7}',WaitForKeys);
//WShell.SendKeys('{F7}{n}',WaitForKeys);
//WShell.AppActivate(VarRetVal);
//FOR I:=0 TO 10 DO BEGIN
// SLEEP(100);
// I+=1;
//END;
//WShell.SendKeys('{n}{ENTER}');
//FOR I:=0 TO 10 DO BEGIN
// SLEEP(100);
// I+=1;
//END;
//WShell.SendKeys('^{a}');
//EXIT(TRUE);

"

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Maybe something like AppActivate could help change the focus on to the window of the Object Designer. I am not sure how to use it yet. Any help would be very much appreciate!!!

  • Jalmaraz Profile Picture
    669 on at

    This is not a solution, but I want to advise you to leave this kind of solution bassed on sendkeys. If you want to automate something use Web services or other task scheduller. I am sorry.

  • Community Member Profile Picture
    on at

    Every answer or reply is much appreciated. Thank you very much for your advise. The truth is I have tried almost everything in order to be able to make Navision autoimport the FOB-s. But I wasn't able to do it. There is even an article where someone developed an DLL for autoimporting FOB-s but didn't worked either. So yes I have tried certain ways and workarounds like this sendkeys but it didn't worked. I don't know what to try next. But as I said every reply and answer is much appreciated by me. So thank you sir and I'll try more and see if I can find a solution to this.

  • Jalmaraz Profile Picture
    669 on at

    You are right: only text files can be imported with automated programs, and this way objects stay no compiled and don´t work. Good luck, if I find something I will tell you.

  • Community Member Profile Picture
    on at

    That's right. I also tried CodeGenius but with no success. So yeah the importation of only text files doesn't help anymore. That would be a great thing if you could come with a solution. Thank you so much, I really appreciate it!

  • ManishKutar Profile Picture
    36 on at

    Hi,

    The only solution I thinkof is using NAV Development Shell and automate it. There are several keywords in NAV 2016 Development Shell. For example, Import-NAVApplicationObject, Export-NAVApplicationObject are commands available.

    Please try exploring into this. Hopefully this helps you. :-)

    Note: I have not tried this yet, however some day I may try this approach.

    Regards,

    Manish

  • Community Member Profile Picture
    on at

    Hi, I don't know if for NAV 2009 R2, could I use this but still. I'll try an aproach because all the other aproaches were epic fails so yeah any idea is much appreciated. Thanks Manish!

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 NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans