windows "Run..." function from NAV

BeliasBelias Member Posts: 2,998
edited 2008-12-04 in NAV Tips & Tricks
hi everyone, actually this is not a tip, but i'm asking for a tip from somone more familiar with these things than me...
in NAV 2009 you can run pages doing start, run,

dynamicsnav:////runpage?page=[page number]

i was wondering if there is a way to run automatically this from a form, passing page number as parameter...is there any automation that can do this?
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Comments

  • BeliasBelias Member Posts: 2,998
    Done!
    OBJECT Form 50000 Bat Launcher
    {
      OBJECT-PROPERTIES
      {
        Date=04/12/08;
        Time=10.24.21;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        Width=7260;
        Height=1760;
        SaveValues=Yes;
        OnOpenForm=BEGIN
                     TXTCommand := 'cmd /c start dynamicsnav:////runpage?page=';
                   END;
    
      }
      CONTROLS
      {
        { 1101339000;TextBox;3520 ;1210 ;3520 ;440  ;CaptionML=[ENU=Page Number;
                                                                ITA=Pagina];
                                                     SourceExpr=TXTPageNo;
                                                     OnValidate=BEGIN
                                                                  IF TXTPageNo <> '' THEN BEGIN
                                                                    FLFile.WRITEMODE(TRUE);
                                                                    FLFile.TEXTMODE(TRUE);
                                                                    FLFile.QUERYREPLACE(FALSE);
                                                                    FLFile.CREATE(TXTFilePath);
                                                                    FLFile.WRITE(TXTCommand + TXTPageNo);
                                                                    FLFile.CLOSE;
                                                                    SHELL(TXTFilePath);
                                                                  END;
                                                                END;
                                                                 }
        { 1101339001;Label  ;110  ;1210 ;3300 ;440  ;ParentControl=1101339000 }
        { 1101339002;TextBox;3520 ;110  ;3520 ;440  ;CaptionML=[ENU=File Name;
                                                                ITA=Nome File];
                                                     SourceExpr=TXTFilePath }
        { 1101339003;Label  ;110  ;110  ;3300 ;440  ;ParentControl=1101339002 }
        { 1101339004;TextBox;3520 ;660  ;3520 ;440  ;CaptionML=[ENU=Command Name;
                                                                ITA=Nome Comando];
                                                     SourceExpr=TXTCommand }
        { 1101339005;Label  ;110  ;660  ;3300 ;440  ;ParentControl=1101339004 }
      }
      CODE
      {
        VAR
          TXTPageNo@1101339000 : Text[100];
          FLFile@1101339001 : File;
          TXTFilePath@1101339002 : Text[100];
          TXTCommand@1101339003 : Text[100];
    
        BEGIN
        END.
      }
    }
    

    Explanation: I create a batch file (name from the first field) and I edit it inserting the code frome the second field + the name of the third field. After that i close the file and I run it with shell.
    I don't delete the batch file in order to not have the alert message every time. queryreplace(false) will skip the message "do you want to replace...?"
    when i'll have time, i'll refine this (e.g. adding commondialog, allowing pagename as well pageno to be inserted etc.)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.