Difference between revisions of "ReNamer:Pascal Script"
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. | ||
− | + | If you are new to Pascal script, follow these steps: | |
− | #Learn the basic Pascal script | + | #Learn the basic syntax of Pascal script (refer to 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 <br>(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 <br>(see the '''In a Nutshell '''section below) |
+ | |||
+ | If you already know how to program Pascal script, you can skip step-1 above. | ||
== Reference == | == Reference == | ||
− | In this section, we will see | + | In this section, we will see all variable types, procedures and functions defined ''within'' ReNamer.<br>(These are <u>not</u> part of the "standard" Pascal Script; so you will not find them anywhere else.) |
*[[ReNamer:Pascal Script:Types|Types]] | *[[ReNamer:Pascal Script:Types|Types]] | ||
Line 34: | Line 36: | ||
== Scripts at the User Forum == | == Scripts at the User Forum == | ||
− | The User Forum contains several ready scripts. Some examples are listed [http://den4b.com/wiki/index.php?title=ReNamer:Scripts here]. Study them and adopt them for your purpose. | + | The User Forum contains several ready scripts. Some examples are listed [http://den4b.com/wiki/index.php?title=ReNamer:Scripts here]. Study them and adopt them for your purpose. |
== Tips == | == Tips == |
Revision as of 14:12, 17 July 2009
The PascalScript Rule in ReNamer uses Pascal Script.
If you are new to Pascal script, follow these steps:
- Learn the basic syntax of Pascal script (refer to the Pascal Script Quick Guide)
- Understand the specific variables, procedures and functions that are defined within ReNamer
(see the Reference section below). - Learn how to use these variables/functions/procedures in Pascal scripts
(see the In a Nutshell section below)
If you already know how to program Pascal script, you can skip step-1 above.
Reference
In this section, we will see all variable types, procedures and functions defined within ReNamer.
(These are not part of the "standard" Pascal Script; so you will not find them anywhere else.)
In a nutshell
In this section, we will see some examples of Pascal Script.
They show how to use ReNamer's types, procedures and functions in Pascal scripts.
- How to rename a file (using the FileName variable)
- How to skip extention (Basic FileName utilities)
- How to convert the filename to ALLCAPS (the WideUpperCase function)
- How to operate on words (Unicode string-handling routines)
- How to serialize files (Basic conversion routines)
- How to initialize variables
- How to create interactive dialogs (let the user decide)
- How to work with folders and paths (FilePath)
- How to break the script execution
Scripts at the User Forum
The User Forum contains several ready scripts. Some examples are listed here. Study them and adopt them for your purpose.
Tips
A few quick tips:
- 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!