mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 1:39 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Autobackup from Navision Client (not NAS)
PostPosted: Fri Oct 12, 2007 4:46 pm 
Offline

Joined: Mon Mar 08, 2004 2:42 pm
Posts: 3255
Location: Hannover
Country: Germany (de)
If you need to create an backup (*.fbk) from the Navision client automaticly, for example at 10:00pm you can use following form / the functions in this form.
Note, that this is an example for working with WSH.

Code: Select all
OBJECT Form 59003 Checklist Make Navision Backup
{
  OBJECT-PROPERTIES
  {
    Date=12.10.07;
    Time=16:46:29;
    Modified=Yes;
    Version List=EXP-GesNeuAnalge;
  }
  PROPERTIES
  {
    Width=10890;
    Height=3410;
    CaptionML=[DEU=Checkliste Datensicherungserstellung;
               ENU=Checklist Make Navision Backup];
    OnOpenForm=BEGIN
                 //01 EXP - RKA +
                 Description := STRSUBSTNO(Text0002,COMPANYNAME,TODAY);
                 CurrForm.txtFilename.ACTIVATE();
                 //01 EXP - RKA -
               END;

  }
  CONTROLS
  {
    { 1   ;CommandButton;6050 ;2640 ;2200 ;550  ;HorzGlue=Right;
                                                 VertGlue=Bottom;
                                                 CaptionML=[DEU=&Erstellen;
                                                            ENU=Create Backup];
                                                 OnPush=VAR
                                                          i@1001 : Integer;
                                                        BEGIN
                                                          //01 EXP - RKA +
                                                          IF (Description = '') THEN
                                                            Description := STRSUBSTNO(Text0002,COMPANYNAME,TODAY);

                                                          IF (Filename = '') OR (Filename = STRSUBSTNO(Text0002,COMPANYNAME,TODAY)) THEN
                                                            ERROR(Text0003);

                                                          IF ISCLEAR(WSHShell) THEN
                                                            CREATE(WSHShell);

                                                          IF ISCLEAR(Timer) THEN
                                                            CREATE(Timer);

                                                          Timer.Interval(10);
                                                          Timer.Enabled(TRUE);
                                                          //01 EXP - RKA -
                                                        END;
                                                         }
    { 3   ;Frame        ;220  ;880  ;10450;1540 ;HorzGlue=Both;
                                                 VertGlue=Both;
                                                 ShowCaption=No }
    { 4   ;TextBox      ;3850 ;1100 ;6600 ;440  ;HorzGlue=Both;
                                                 ParentControl=3;
                                                 InFrame=Yes;
                                                 CaptionML=[DEU=Beschreibung;
                                                            ENU=Description];
                                                 SourceExpr=Description }
    { 5   ;Label        ;440  ;1100 ;3300 ;440  ;ParentControl=4 }
    { 6   ;TextBox      ;3850 ;1760 ;6600 ;440  ;Name=txtFilename;
                                                 HorzGlue=Both;
                                                 ParentControl=3;
                                                 InFrame=Yes;
                                                 CaptionML=[DEU=Dateiname;
                                                            ENU=Filename];
                                                 SourceExpr=Filename;
                                                 OnAssistEdit=BEGIN
                                                                //01 EXP - RKA +
                                                                Filename := CMDMgmt.OpenFile(Text0001,STRSUBSTNO(Text0002,COMPANYNAME,TODAY) + '.fbk',4,'*.fbk',1);
                                                                IF (STRPOS(Filename,':\') = 0) THEN
                                                                  Filename := '';
                                                                //01 EXP - RKA -
                                                              END;
                                                               }
    { 7   ;Label        ;440  ;1760 ;3300 ;440  ;ParentControl=6 }
    { 2   ;CommandButton;8470 ;2640 ;2200 ;550  ;HorzGlue=Right;
                                                 VertGlue=Bottom;
                                                 PushAction=FormHelp;
                                                 CaptionML=DEU=&Hilfe }
    { 8   ;Label        ;220  ;0    ;10450;770  ;HorzGlue=Both;
                                                 VertGlue=Top;
                                                 HorzAlign=Center;
                                                 ForeColor=3368703;
                                                 FontSize=15;
                                                 FontBold=Yes;
                                                 LeaderDots=No;
                                                 CaptionML=[DEU=GARAK - Navision Datensicherung;
                                                            ENU=GARAK - Navision Backup] }
  }
  CODE
  {
    VAR
      CMDMgmt@1001 : Codeunit 412;
      WSHShell@1000 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell";
      Timer@1003 : Automation "{3B311C81-140E-11D5-8B18-00D0590B4EC5} 1.0:{3B311C92-140E-11D5-8B18-00D0590B4EC5}:'Navision Timer 1.0'.Timer" WITHEVENTS;
      ShellIsSend@1005 : Boolean;
      ShellIsSend2@1006 : Boolean;
      Description@1007 : Text[50];
      Filename@1008 : Text[1024];
      Text0001@1002 : TextConst 'DEU=Backup speichern;ENU=Backup save.';
      Text0002@1009 : TextConst 'DEU=Backup %1 vom %2;ENU=Backup %1 by %2';
      Text0003@1010 : TextConst 'DEU=Dateiname ist anzugeben;ENU=Fill out filename';
      Text0004@1000000000 : TextConst 'DEU=%xs;ENU=%tb';

    EVENT Timer@1003::Timer@1(Milliseconds@1000 : Integer);
    BEGIN
      //01 EXP - RKA +
      IF NOT ShellIsSend THEN BEGIN
        WSHShell.SendKeys(Text0004);
        ShellIsSend := TRUE;
      END ELSE BEGIN
        IF NOT ShellIsSend2 THEN BEGIN
          WSHShell.SendKeys(Description);
          WSHShell.SendKeys('{DOWN}');
          WSHShell.SendKeys(Filename);
          WSHShell.SendKeys('{DOWN}');
          WSHShell.SendKeys('{Enter}');
          WSHShell.SendKeys('{Enter}');
          ShellIsSend2 := TRUE;
          Timer.Enabled(FALSE);
        END;
      END;
      //01 EXP - RKA -
    END;

    EVENT Timer@1003::TimerError@2(ErrorString@1000 : Text[1024]);
    BEGIN
    END;

    BEGIN
    {
      *---------------------------------------------*
      >   Copyright XXXXXXXXXXXXXXXXXXXXXXXX        >
      >                XXX                          >
      *---------------------------------------------*

      Nr.  Modul Datum     Krzel   Beschreibung
    }
    END.
  }
}



The Form ist tested in Nav. 4.0x. German and English Language.

Regards

_________________
Do you make it right, it works too!


Last edited by garak on Tue Sep 23, 2008 9:04 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 2:12 pm 
Offline

Joined: Thu Jan 26, 2006 8:01 am
Posts: 126
Location: Slovenia
Country: Slovenia (si)
good job garak :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 4:50 pm 
Offline

Joined: Wed May 10, 2006 11:25 am
Posts: 149
Location: Kiev
Country: Ukraine (ua)
Hi


I must ask a big thanks to Kine for idea with BEEP function
http://msmvps.com/blogs/kine/archive/2007/09/07/powerfull-command-in-microsoft-dynamics-nav-beep.aspx#comments

This my tool base on this means - tool for create a NAV release from a lot objects
http://www.geocities.com/yagaponov/Navision/Release/

So can be this help you :D

_________________
Yaroslav Gaponov


Top
 Profile E-mail WWW  
 
 Post subject: Hi Garak
PostPosted: Fri Oct 19, 2007 10:49 am 
Offline

Joined: Tue Aug 07, 2007 11:06 am
Posts: 22
Location: New Delhi
Country: India (in)
That's Great work ...

But I want to know from U how to set the time to take Backup automatically as the code tells.Because, there is no option to set time manually in the form.

Any help ...?

_________________
Hi


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 10:43 pm 
Offline

Joined: Mon Mar 08, 2004 2:42 pm
Posts: 3255
Location: Hannover
Country: Germany (de)
take a look to the Job Sheduler module in Navision.
Here you can rznd reports or Codeunits.

Store this Code into an CU and than run the CU from Sheduler

_________________
Do you make it right, it works too!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 13, 2008 12:33 pm 
Offline

Joined: Wed May 07, 2008 8:59 am
Posts: 20
Location: Kolkata
Country: India (in)
Great work.. We tried on this through job schedular, but it is not run. Can you tell me the total process of how run job schedular. Please tel me the same.
Thanks..


Top
 Profile  
 
 Post subject: Navision Automatic Backup
PostPosted: Fri Aug 01, 2008 4:45 pm 
Offline

Joined: Wed Jul 30, 2008 4:04 pm
Posts: 27
Location: HYDERABAD
Country: India (in)
hi ,
Can any one help....................
i have downloaded one object to take navision backup automatically from the client .But How to set time to take backup at certain intervals.When i set a time interval for the first time its taking backup automatically but next time its not taking backup ,because message coming as Backup complted successfully.
Due to this reason its generating next backup how to avoid that message.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 01, 2008 5:50 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
you could always try this.
http://www.mibuso.com/forum/viewtopic.php?t=20036

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 10:23 am 
Offline

Joined: Wed Jul 30, 2008 4:04 pm
Posts: 27
Location: HYDERABAD
Country: India (in)
i have downloaded this ,but how to is this can u tell me.......

please.................Is it for automatic Backup?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 4:13 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
did you read the post. I think on the first line it say Automatic Backup.

If you click on the finalization tab you'll see it will ask you to create a scheduled task.

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Autobackup from Navision Client (not NAS)
PostPosted: Tue Sep 23, 2008 8:59 pm 
Offline

Joined: Mon Aug 11, 2008 4:55 pm
Posts: 21
Location: North East
Country: United States (us)
(updated 1/27/2010)=======

SQL backup works perfectly well for my case, since we are running Navision with MS-SQL database. The entire database is backed up once daily, and all transactions are being backed up very 2 hours. All of these jobs are managed and handled beautifully by SQL server.


============= end update 1/27/2010 ======================
Thanks for your code. It works.

However, if I set them timeinterval value to 1 hour (3600000), the sendkey commands fail to set the values of those textboxes (description and filename) in the backup-database window. I am trying to test to see whether we could have a Navision session running 24/7 with timer set to be triggered every 1 hour. We want to have the dabase backed up only 1 per day, on certain time in the evening; such as, 10:00PM.

The timer is unable to sendkey to the backup windows.

Any advice or suggestion(s)?

Thanks.


Last edited by mcaverly on Wed Jan 27, 2010 8:47 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Autobackup from Navision Client (not NAS)
PostPosted: Tue Sep 23, 2008 9:33 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
Have you read this?
http://dynamicsuser.net/blogs/kine/arch ... -beep.aspx

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Autobackup from Navision Client (not NAS)
PostPosted: Tue Sep 23, 2008 9:35 pm 
Offline

Joined: Mon Mar 08, 2004 2:42 pm
Posts: 3255
Location: Hannover
Country: Germany (de)
Between the sendkey commands, you can wait some miliseconds. For example with the BEEP Function

_________________
Do you make it right, it works too!


Top
 Profile  
 
 Post subject: Re: Autobackup from Navision Client (not NAS)
PostPosted: Tue Sep 23, 2008 10:33 pm 
Offline

Joined: Mon Aug 11, 2008 4:55 pm
Posts: 21
Location: North East
Country: United States (us)
I am calling Beep(1,1000);
It does not work.

I will try few more times.

Thanks all for your response.


Top
 Profile  
 
 Post subject: Re: Autobackup from Navision Client (not NAS)
PostPosted: Tue Sep 23, 2008 11:03 pm 
Offline

Joined: Mon Aug 11, 2008 4:55 pm
Posts: 21
Location: North East
Country: United States (us)
I have tried with various durant values, Beep(1,x). However the routine fails to sendkeys to the backup window.

If I set the timer's interval back to 10, the routine works perfectly.

Any advice or suggestions?

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: