Difference between revisions of "ReNamer:Rules:PascalScript"
Line 1: | Line 1: | ||
− | == PascalScript Rule == | + | == PascalScript Rule == |
− | <center>[[Image:PascalScriptRule.png]]</center> | + | <center>[[Image:PascalScriptRule.png]]</center> |
+ | This rule uses [[ReNamer:Pascal Script|Pascal/Delphi programming]] syntax and conventions. ReNamer comes with some preloaded scripts. We will see how to use them, and how to add a new script. | ||
− | + | === Using a ready script === | |
− | + | #Click on the [[Image:ScriptsButton.png]] button (located just below the '''Configuration '''pane). | |
− | # Click on the [[Image:ScriptsButton.png]] button (located just below the '''Configuration '''pane). | + | #:A list of scripts appears. |
− | #: A list of scripts appears. | + | #:[[Image:PascalScriptsMenu.png]] |
− | #: [[Image:PascalScriptsMenu.png]] | + | #All available scripts are listed ''above'' the line. Click on any script to load it into the '''Configuration '''pane. |
− | # All available scripts are listed ''above'' the line. Click on any script to load it into the '''Configuration '''pane. | + | #Edit the script if required |
− | # Edit the script if required | + | #Press [[Image:AddRuleButton.png]] button to add the script to the rule stack. |
− | # Press [[Image:AddRuleButton.png]] button to add the script to the rule stack. | + | #Repeat steps 1-4 to add more script-based rules. |
− | # Repeat steps 1-4 to add more script-based rules. | + | |
+ | === Borrowing scripts from forum === | ||
− | |||
Even if you do not know how to write a script, you can easily use scripts written by others. | Even if you do not know how to write a script, you can easily use scripts written by others. | ||
− | First, visit the User Forum and search for a suitable script. The Forum already has a large number of such scripts. Some of these scripts have embedded comments about how to customize the script. | + | First, visit the [http://www.den4b.com/forum/ '''User Forum'''] and search for a suitable script. The Forum already has a large number of such scripts. Some of these scripts have embedded comments about how to customize the script. |
If you cannot find a suitable script, you can request other users to write a script for you. | If you cannot find a suitable script, you can request other users to write a script for you. | ||
Once you find such a script, follow these simple steps: | Once you find such a script, follow these simple steps: | ||
+ | |||
{| class="prettytable" | {| class="prettytable" | ||
− | ! <center>Step</center> | + | |- |
+ | ! <center>Step</center> | ||
! <center>Details</center> | ! <center>Details</center> | ||
− | |||
|- | |- | ||
− | | <center>1</center> | + | | <center>1</center> |
− | | '''Copy the script''' | + | | '''Copy the script''' |
− | + | Copy the script from the forum (ensure that nothing is left out) | |
− | Copy the script from the forum (ensure that nothing is left out) | ||
|- | |- | ||
− | | <center>2</center> | + | | <center>2</center> |
− | | '''Clear the ReNamer's Configuration pane''' | + | | '''Clear the ReNamer's Configuration pane''' |
− | + | Open the Pascal Script Rule in ReNamer. Select the three lines you see in the '''Configuration''' pane, and press DEL. (Those lines are meant to begin a script from scratch). | |
− | Open the Pascal Script Rule in ReNamer. Select the three lines you see in the '''Configuration''' pane, and press DEL. (Those lines are meant to begin a script from scratch). | ||
|- | |- | ||
− | | <center>3</center> | + | | <center>3</center> |
− | | '''Paste the script into ReNamer pane''' | + | | '''Paste the script into ReNamer pane''' |
− | + | Use the '''CTRL+V''' shortcut or right-click and select '''Paste.''' | |
− | Use the '''CTRL+V''' shortcut or right-click and select '''Paste.''' | ||
|- | |- | ||
− | | <center>4</center> | + | | <center>4</center> |
− | | '''Compile the script''' | + | | '''Compile the script''' |
Press the [[Image:TryToCompileButton.png]] button. | Press the [[Image:TryToCompileButton.png]] button. | ||
− | * In case some error comes up, you can try and troubleshoot the problematic statement in the script using the [[Image:GotoButton.png]] button. | + | |
− | *:It pops up a window like this: | + | *In case some error comes up, you can try and troubleshoot the problematic statement in the script using the [[Image:GotoButton.png]] button. |
− | *:<center>[[Image:GotoLineDialog.png]]</center> | + | *:It pops up a window like this: |
− | *:Now enter the line number in the window and press '''OK'''. It takes you to the faulty statement. | + | *:<center>[[Image:GotoLineDialog.png]]</center> |
− | * If the script compiles successfully, this button is not required at all. | + | *:Now enter the line number in the window and press '''OK'''. It takes you to the faulty statement. |
+ | *If the script compiles successfully, this button is not required at all. | ||
|- | |- | ||
− | | <center>5</center> | + | | <center>5</center> |
− | | '''Saving the script and giving it a name:''' | + | | '''Saving the script and giving it a name:''' |
+ | The '''save '''button is hidden under the '''scripts '''menu. So first click on the [[Image:ScriptsButton.png]] button. It pops up a window like this: | ||
+ | <center>[[Image:PascalScriptsMenu.png]]</center> | ||
+ | Note that all the existing scripts are listed here. (Your new script will also be added to this list.) | ||
− | + | Select the '''Save script... '''option (at the very bottom of the menu). Another window pops up. | |
+ | <center>[[Image:SaveScriptDialog.png]]</center> | ||
+ | Enter a name that suggests the function of your script. Press '''OK'''. The new name is added to the list of scripts. Now use it as described [[ReNamer:Rules:PascalScript#Using_a_script|above]]. | ||
− | + | |} | |
− | + | === Writing your own scripts === | |
− | + | To write your own scripts, you must have knowledge of Pascal script. | |
− | |||
− | |||
− | + | Learning Pascal script is easy. Refer to the [[ReNamer:Pascal Script|'''Pascal Script section''']]. <br> Here, we will assume that you already know how to write pascal scripts. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | The step-by-step procedure is as follows: | |
− | |||
− | + | #Click in the Configuration pane and enter the script directly. (You can also copy it from anywhere and paste it into the pane by pressing '''CTRL+V'''. Or right-click in the pane and select the '''Paste''' option from the context menu.) | |
− | # Click in the Configuration pane and enter the script directly. (You can also copy it from anywhere and paste it into the pane by pressing '''CTRL+V'''. Or right-click in the pane and select the '''Paste''' option from the context menu.) | + | #Compile the script by pressing the [[Image:TryToCompileButton.png]] button located below the Configuration pane. |
− | # Compile the script by pressing the [[Image:TryToCompileButton.png]] button located below the Configuration pane. | + | #*If an error message comes up, troubleshoot the script. The fault message usually includes the line number of the problematic statement in the script. Press the [[Image:GotoButton.png]] button and enter that line number to locate the faulty statement quickly. Then edit that line and press the [[Image:TryToCompileButton.png]] button again. Repeat this till a '''''Compiled successfully!''''' message pops up. |
− | #* If an error message comes up, troubleshoot the script. The fault message usually includes the line number of the problematic statement in the script. Press the [[Image:GotoButton.png]] button and enter that line number to locate the faulty statement quickly. Then edit that line and press the [[Image:TryToCompileButton.png]] button again. Repeat this till a '''''Compiled successfully!''''' message pops up. | + | #Press the [[Image:ScriptsButton.png]] button. A list pops up: |
− | # Press the [[Image:ScriptsButton.png]] button. A list pops up: | + | #:<center>[[Image:PascalScriptsMenu.png]]</center> |
− | #: <center>[[Image:PascalScriptsMenu.png]]</center> | + | #Click on the '''Save Script...'''(the last option in the list). Now this script is added to the list (it appears above the line in the list). |
− | # Click on the '''Save Script...'''(the last option in the list). Now this script is added to the list (it appears above the line in the list). | + | #:Now you can use that script as described [[ReNamer:Rules:PascalScript#Using_a_script|above]] |
− | #: Now you can use that script as described [[ReNamer:Rules:PascalScript#Using_a_script|above]] |
Revision as of 08:48, 11 July 2009
PascalScript Rule
This rule uses Pascal/Delphi programming syntax and conventions. ReNamer comes with some preloaded scripts. We will see how to use them, and how to add a new script.
Using a ready script
- Click on the button (located just below the Configuration pane).
- All available scripts are listed above the line. Click on any script to load it into the Configuration pane.
- Edit the script if required
- Press button to add the script to the rule stack.
- Repeat steps 1-4 to add more script-based rules.
Borrowing scripts from forum
Even if you do not know how to write a script, you can easily use scripts written by others.
First, visit the User Forum and search for a suitable script. The Forum already has a large number of such scripts. Some of these scripts have embedded comments about how to customize the script.
If you cannot find a suitable script, you can request other users to write a script for you.
Once you find such a script, follow these simple steps:
Copy the script
Copy the script from the forum (ensure that nothing is left out) | |
Clear the ReNamer's Configuration pane
Open the Pascal Script Rule in ReNamer. Select the three lines you see in the Configuration pane, and press DEL. (Those lines are meant to begin a script from scratch). | |
Paste the script into ReNamer pane
Use the CTRL+V shortcut or right-click and select Paste. | |
Compile the script | |
Saving the script and giving it a name:
The save button is hidden under the scripts menu. So first click on the button. It pops up a window like this: Note that all the existing scripts are listed here. (Your new script will also be added to this list.) Select the Save script... option (at the very bottom of the menu). Another window pops up. Enter a name that suggests the function of your script. Press OK. The new name is added to the list of scripts. Now use it as described above. |
Writing your own scripts
To write your own scripts, you must have knowledge of Pascal script.
Learning Pascal script is easy. Refer to the Pascal Script section.
Here, we will assume that you already know how to write pascal scripts.
The step-by-step procedure is as follows:
- Click in the Configuration pane and enter the script directly. (You can also copy it from anywhere and paste it into the pane by pressing CTRL+V. Or right-click in the pane and select the Paste option from the context menu.)
- Compile the script by pressing the button located below the Configuration pane.
- If an error message comes up, troubleshoot the script. The fault message usually includes the line number of the problematic statement in the script. Press the button and enter that line number to locate the faulty statement quickly. Then edit that line and press the button again. Repeat this till a Compiled successfully! message pops up.
- Press the button. A list pops up:
- Click on the Save Script...(the last option in the list). Now this script is added to the list (it appears above the line in the list).
- Now you can use that script as described above