Friday, April 5, 2013

Get the count of rows selected

long ll_Selected

ll_Selected = &
  long(dw_1.describe("evaluate('sum( if(isselected(), 1, 0) for all)',1)"))
 
 
Source : http://www.rgagnon.com/pbdetails/pb-0183.html 

Get Page Number of the Report

Put the datawindow into print preview mode
dw_1.modify &
  ( 'datawindow.print.preview=yes' )
Get the result of the 'PageCount()' expression
ll_PageCount = &
   long ( dw_1.describe &
     ("evaluate('pagecount()'," + string ( dw_1.rowcount() ) + ")"))

Menjalankan Winrar dengan Command Line Window


This section provides a tutorial example on how to run WinRAR in a command line window.
   

WinRAR also support command line operations. This is important to allow users to incorporate WinRAR commands into automated scripts. Here is a simple script I used to backup a directory, backup.bat:

@rem backup.bat
@rem Usage: backup directory zipfile password

\local\winrar\winrar a -afzip -r -p%3 %2.zip %1\*.*

My restore script is also very simple, restore.bat:

@rem restore.bat
@rem Usage: restore zipfile password

\local\winrar\winrar x -p%2 %1.zip .\

Note that:

    Command "a" is to create archive files.
    Option "-afzip" is to create archive files in ZIP format.
    Option "-r" is to take input files recursively to include sub-directories.
    Option "-p*" is to add password protection to archive files.
    Command "x" is to extract files out of archive files.

For complete description of the command line interface of WinRAR, see the WinRAR help document.

Source : © 2008 by Dr. Herong Yang.
All rights reserved.

Using the WinRAR Command-line tools in Windows

This guide describes the use of the WinRAR command-line tools for compressing and uncompressing files in a directory and their use in batch files. This guide is an extension of a previous post, Automate Zipping Tasks using the Command-line Interface that covered the use of the command-line tools for two free compression utilities, IZArc and 7-Zip. The information was tested on a Windows PC running Vista.

compress

WinRAR is a popular and powerful archive manager that can be used from the command-line or with scripting languages such as batch files. It includes two command-line tools, rar.exe and unrar.exe, where rar.exe compresses and unrar.exe uncompresses files. Both are located in the “C:\Program Files\WinRAR” folder in the installable version. Although WinRAR is shareware, it can be used on a trial basis for 40 days. Using WinRAR’s command-line tools is similar to those for IZArc and 7-Zip. The syntax for using the WinRAR executables is:

WinRAR <command> -<switch1> -<switchN> <archive> <files...> <@listfiles...> <path_to_extract\>

Examples to compress a folder:

rar a -r yourfiles.rar *.txt c:\yourfolder

creates archive yourfiles.rar and compresses all .txt files in c:\yourfolder and all its subfolders

rar a yourfiles

creates archive yourfiles.rar and compresses all files in the current folder, but doesn’t include subfolders (note lack of extension; WinRAR will use the default extension .rar)

“a” command adds to the archive

“-r”  switch recurses subfolders
Examples to uncompress a folder:

unrar x c:\yourfile.rar *.gif c:\extractfolder\

extracts all *.gif files from yourfile.rar to c:\extractfolder\ (trailing backslash required) and restores the folder structure

unrar e c:\yourfile.rar

extracts all files in c:\yourfile.rar to the current folder (folder structure ignored)

“x” command extracts with full paths

“e” command extracts and ignores paths

Basic rules for WinRAR:

    When files or listfiles are not specified, all files in the current folder are processed
    When specifying all files in a folder, yourfolder or yourfolder\*.* are equivalent
    Folder structures are automatically saved in archives (but not automatically extracted)
    WinRAR uses the .rar extension by default, but that can be overridden by specifying the zip extension in the archive name
    Switches and commands are not case sensitive and can be written in either upper or lower case

Another point is that WinRAR doesn’t appear to use the Windows path environment variable, so it must be specified either at a command prompt, set permanently in the environment variable settings, or specified in a batch file.

To set the Windows path environment variable temporarily at a command prompt or in a batch file, use the following command:

set path="C:\Program Files\WinRAR\";%path%

To set it permanently in the Windows path for your PC:

start–>Control Panel–>System–>Advanced system settings–>Advanced Tab–>Environment Variables–>System Variables–>Path–>Edit. Add the path ;C:\Program Files\WinRAR; to the end (don’t forget the single semicolons at the beginning and end). Hit OK three times.
Using WinRAR in Batch Files:

Two batch file examples are provided. The first compresses all files in a folder or a folder and its subfolders, with the option to compress the files into a single archive or individually. The second batch file decompresses all .rar files from a folder and places the extracted files into another directory. Be sure to change the extension(s) to .bat before using either file. Both of the following batch files temporarily set the Windows path environment variable for the WinRAR folder when executed.


Source : http://comptb.cects.com/2503-using-the-winrar-command-line-tools-in-windows