Regarding SendKeys

Naidu.GNaidu.G Member Posts: 31
Hi Experts,

I created a form in that i wrote code in ontimer trigger
for taking the database backup .Once if it completes to take the backup i recieve one message that backup is successfully completed. But my problem is how to find when the backup is completed, in that time i want to automatically press enter. But i wrote the code using the sendkeys function it is not working.


Ex:-


wscript.sendkeys(%tb);
wscript.sendkeys(descriptin);
wscript.sendkeys({tab});
wscript.sendkeys(filename);
wscript.sendkeys({tab});
wscript.sendkeys({enter});

like that i wrote the code, but my probleam is when the backup is completed and how to automatically press enter.

After the above code i wrote the code
if i = 1050 then
wscript.sendkeys({enter});
i+=1;

but this code is execute after 3 minits but the database is large means how the backup is completed the 3 minits itself so, how to find the backup completion. ](*,)

Comments

  • matttraxmatttrax Member Posts: 2,309
    Although not the most reliable (it can take a long time to recognize that it exists) you can use a record variable for the File table. Set your filters for the filename, path, and "is a file" fields and REPEAT UNTIL the file is found.
  • AsallaiAsallai Member Posts: 141
    Check the created files Size in the specific folder they are growing or not. For example after one minute...
    Of course, if it is more than one file, the name is generated and find the last one.
    :-k
  • garakgarak Member Posts: 3,263
    If you use the "Search the Forum" function, you will find this post.

    http://www.mibuso.com/forum/viewtopic.php?t=21430

    Regards
    Do you make it right, it works too!
  • Naidu.GNaidu.G Member Posts: 31
    hi garak,
    i download the automatic backup form in mibuso downloads but in that also after taking the database backup we have to manually press enter. but my probleam is after taking the backup automatically press the enter and i should know when the backup is completed. ](*,)




    Regards
  • garakgarak Member Posts: 3,263
    with the last {Enter} the systen accept the the ENTER command after the fbk is finished and used this ENTER for the message dlg.

    Only problem: NAV must have the focus. Application must be active ....
    So don't click when the backupprocess is running .......
    Do you make it right, it works too!
  • Naidu.GNaidu.G Member Posts: 31
    Hi all,

    i wrote the code in ontimer trigger as follows.


    FilePath := FORMAT(DATE2DMY(TODAY,1));
    FilePath += FORMAT(DATE2DMY(TODAY,2));
    FilePath += FORMAT(DATE2DMY(TODAY,3));
    FilePath += DELSTR(FORMAT(TIME),3,9);
    IF State = 0 THEN
    FilePath += 'Hours';
    FilePath1:='NavBackup' + FilePath+'.fbk';

    FilePath:='D:\NavBackup'+FilePath+'.fbk';


    IF State = 0 THEN BEGIN
    wscript.SendKeys('%tb');
    DT := CREATEDATETIME(TODAY,T);
    END;

    IF State = 2 THEN
    wscript.SendKeys('Nav Backup');
    IF State = 3 THEN
    wscript.SendKeys('{tab}');
    IF State = 4 THEN
    wscript.SendKeys(FilePath);
    IF State = 5 THEN
    wscript.SendKeys('{tab}');
    IF State = 6 THEN
    wscript.SendKeys('{ENTER}');

    If State = 15 then
    wscript.SendKeys('{ENTER}');


    IF State = 16 THEN
    SHELL('c:\windows\system32\cmd.exe');
    IF State = 20 THEN
    wscript.SendKeys('cd\');

    IF State = 23 THEN
    wscript.SendKeys('{enter}');

    IF State = 25 THEN
    wscript.SendKeys('d:' );

    IF State = 27 THEN
    wscript.SendKeys('{enter}' );


    IF State = 28 THEN
    wscript.SendKeys('if exist ' );

    IF State = 29 THEN
    wscript.SendKeys(FilePath1);

    IF State = 30 THEN
    wscript.SendKeys(' rar a ');
    IF State = 32 THEN
    wscript.SendKeys('d:\nav1.rar ');

    IF State = 35 THEN
    wscript.SendKeys(FilePath);

    IF State = 38 THEN
    wscript.SendKeys('{enter}');

    IF State = 45 THEN
    wscript.SendKeys('exit');

    IF State = 48 THEN
    wscript.SendKeys('{enter}');

    IF State = 88 THEN
    BEGIN
    wscript.SendKeys('%{tab}');
    wscript.SendKeys('esc');
    END;

    State+=1;

    But my problem is after taking the backup it shows the message like backup is successfully completed, after that i worte the automatic zip also
    but that code is not working because of the message box (Backup is successfully completed) when ever we press enter key manually after that the remaining code will be executed.

    How can i find the backup is completed or not

    Thanks & Regards,
    Naidu.
    ](*,)
  • garakgarak Member Posts: 3,263
    ähm, other question. do you use Native database or SQL database?
    Do you make it right, it works too!
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    How can i find the backup is completed or not
    Exists(FilePath)
    
    ???????? ..... :-k
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • Naidu.GNaidu.G Member Posts: 31
    Hi,
    i am using Navtive database


    Thanks & Regards
  • SavatageSavatage Member Posts: 7,142
    the navbackup lite, in the download section, works great for me
Sign In or Register to comment.