Difference between revisions of "ReNamer:Pascal Script"

From den4b Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
The [[ReNamer:Rules:PascalScript|'''PascalScript Rule''']] in ReNamer uses Pascal Script.  
 
The [[ReNamer:Rules:PascalScript|'''PascalScript Rule''']] in ReNamer uses Pascal Script.  
  
To exploit the full power of Pascal scripts, you will have to follow these steps:  
+
To be able to use Pascal script, follow these steps:  
  
#Learn the basic Pascal script syntax (see the '''Pascal script Quick Guide''' in '''Reference''' section below)  
+
#Learn the basic Pascal script syntax (see the [[ReNamer:Pascal Script:Pascal Script quick guide|Pascal Script Quick Guide]])  
 
#Understand the specific variables, procedures and functions that are defined within ReNamer (see the '''Reference''' section below).<br>  
 
#Understand the specific variables, procedures and functions that are defined within ReNamer (see the '''Reference''' section below).<br>  
 
#Learn how to use these variables/functions/procedures in Pascal scripts (see the '''In a Nutshell '''section below)
 
#Learn how to use these variables/functions/procedures in Pascal scripts (see the '''In a Nutshell '''section below)
  
A few quick tips:
+
== Reference  ==
  
*The '''FileName''' variable represents the New Name of the File. <br>Therefore Pascal script manipulates this variable to change the filename.
+
In this section, we will see a list of all variable types, procedures and functions defined ''within'' ReNamer.<br>(These are <u>not</u> part of the Pascal Script; so they will not be found anywhere else.)
*The '''FilePath''' constant holds the original path of the file. It allows you to access the file directly.<br>  
 
*ReNamer supports UDFs (User-Defined Functions) and also importing of external functions from DLLs.
 
*All manipulations with the '''FileName''' variable should be done using Unicode functions, i.e. '''WideString '''[[ReNamer:Pascal Script:Types|type]] should be used instead of an ordinary '''String''' type. This will allow ReNamer to handle filenames in non-English scripts (Cyrillic, Asian, German, French, etc.)<br>
 
  
<span style="color: red;">'''Warning:''' Do not override ReNamer's built-in variables, [[ReNamer:Pascal Script:Types|types]] and [[ReNamer:Pascal Script:Functions|functions]]</span>
+
*[[ReNamer:Pascal Script:Types|Types]]  
 +
*[[ReNamer:Pascal Script:Functions|Procedures and functions]]
  
<span style="color: red;">'''Warning:''' Some of the functions are able to alter your file system (create new folders, move files, etc.). So use them with caution! </span>
+
== In a nutshell  ==
  
<br>
+
In this section, we will see some examples of Pascal Script.
 
 
== Reference  ==
 
 
 
*[[ReNamer:Pascal Script:Pascal Script quick guide|Pascal Script Quick guide]]
 
*[[ReNamer:Pascal Script:Types|Types]]
 
*[[ReNamer:Pascal Script:Functions|Functions]]
 
  
== In a nutshell  ==
+
They show how "standard" Pascal Scrip can use the types, procedures and functions defined in ReNamer.
  
 
#[[ReNamer:Pascal Script:FileName|How to rename a file (]][[ReNamer:Pascal Script:FileName|using the '''FileName''' variable)]]  
 
#[[ReNamer:Pascal Script:FileName|How to rename a file (]][[ReNamer:Pascal Script:FileName|using the '''FileName''' variable)]]  
Line 37: Line 29:
 
#[[ReNamer:Pascal Script:FilePath|How to work with folders and paths (]][[ReNamer:Pascal Script:FilePath|FilePath)&nbsp;]]  
 
#[[ReNamer:Pascal Script:FilePath|How to work with folders and paths (]][[ReNamer:Pascal Script:FilePath|FilePath)&nbsp;]]  
 
#[[ReNamer:Pascal Script:Break script execution|How to break the script execution]]
 
#[[ReNamer:Pascal Script:Break script execution|How to break the script execution]]
 +
 +
<br>
 +
 +
== Tips  ==
 +
 +
A few quick tips before you leave this section:
 +
 +
*In Pascal Script, ReNamer has defined the '''FileName''' variable to represent the New Name of the File. <br>Therefore, in your script, you will have to manipulate this variable to change the filename.
 +
*The '''FilePath''' constant holds the original path of the file. It allows you to access the file directly.<br>
 +
*ReNamer supports UDFs (User-Defined Functions) and also importing of external functions from DLLs.<br>??? what is the syntax for referencing such an external routine?
 +
*Try to use '''WideString '''[[ReNamer:Pascal Script:Types|type]] instead of an ordinary '''String''' type. This will allow ReNamer to handle Unicode filenames.<br>(In other words, it will be able to handle non-English scripts, such as Cyrillic, Asian, German, French, etc.)<br>
 +
 +
<span style="color: red;">'''Warning:''' Do not override ReNamer's built-in variables, types and functions.</span>
 +
 +
<span style="color: red;">'''Warning:''' Some of the functions are able to alter your file system (create new folders, move files, etc.). So use them with caution! </span>

Revision as of 13:07, 14 July 2009

The PascalScript Rule in ReNamer uses Pascal Script.

To be able to use Pascal script, follow these steps:

  1. Learn the basic Pascal script syntax (see the Pascal Script Quick Guide)
  2. Understand the specific variables, procedures and functions that are defined within ReNamer (see the Reference section below).
  3. Learn how to use these variables/functions/procedures in Pascal scripts (see the In a Nutshell section below)

Reference

In this section, we will see a list of all variable types, procedures and functions defined within ReNamer.
(These are not part of the Pascal Script; so they will not be found anywhere else.)

In a nutshell

In this section, we will see some examples of Pascal Script.

They show how "standard" Pascal Scrip can use the types, procedures and functions defined in ReNamer.

  1. How to rename a file (using the FileName variable)
  2. How to skip extention (Basic FileName utilities) 
  3. How to convert the filename to ALLCAPS (the WideUpperCase function) 
  4. How to operate on words (Unicode string-handling routines) 
  5. How to serialize files (Basic conversion routines) 
  6. How to initialize variables
  7. How to create interactive dialogs (let the user decide)
  8. How to work with folders and paths (FilePath) 
  9. How to break the script execution


Tips

A few quick tips before you leave this section:

  • In Pascal Script, ReNamer has defined the FileName variable to represent the New Name of the File.
    Therefore, in your script, you will have to manipulate this variable to change the filename.
  • The FilePath constant holds the original path of the file. It allows you to access the file directly.
  • ReNamer supports UDFs (User-Defined Functions) and also importing of external functions from DLLs.
    ??? what is the syntax for referencing such an external routine?
  • Try to use WideString type instead of an ordinary String type. This will allow ReNamer to handle Unicode filenames.
    (In other words, it will be able to handle non-English scripts, such as Cyrillic, Asian, German, French, etc.)

Warning: Do not override ReNamer's built-in variables, types and functions.

Warning: Some of the functions are able to alter your file system (create new folders, move files, etc.). So use them with caution!