Automation Script Contest: 3 Free Salamander Licenses

This is a place for users to discuss Altap Salamander. Please feel free to ask, answer questions, and express your opinion. Please do not post problems, bug reports or feature requests here.
manison
Plugin Developer
Plugin Developer
Posts: 216
Joined: 09 Dec 2005, 23:23
Location: Ceske Budejovice, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by manison »

KNUT wrote:
Georgd wrote:
KNUT wrote:My workaround:
Crashes Salamander, too
No crash! Works fine here:
Can you please confirm whether the script crashes when executed from Script Popup Menu and when executed from Plugins Menu, Plugin Bar or through assigned hotkey? It seems that there is a bug in Automation that takes Salamander down if a script displays progress dialog and is executed from popup menu.
User avatar
th.
Posts: 116
Joined: 04 Sep 2006, 23:09
Location: Germany

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by th. »

manison wrote: Can you please confirm whether the script crashes when executed from Script Popup Menu and when executed from Plugins Menu, Plugin Bar or through assigned hotkey? It seems that there is a bug in Automation that takes Salamander down if a script displays progress dialog and is executed from popup menu.
I think you are right. No crash when executed from the plugin menu or through a hotkey.
AS crashes when the script is executed from the popup menu. Without the progress dialog it doesn't crash.

In the original post I have modified the script with the workaround by KNUT (permission assumed) to remove the dependency on the regional date format settings.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Jan Rysavy »

Manison with Petr have fixed this problem. We will release AS 2.53 beta 2 (with German translation from Thomas and others) soon.
User avatar
murphy
Posts: 10
Joined: 20 Dec 2005, 17:50

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by murphy »

Here is my entry for the contest. I created a script for removing the Zone.Identifier information. You can then execute Installation or Applications downloaded from web without the warning.
When no file is selected it will use the complete folder for processing. Otherwise the selection or current file.

Code: Select all

/*
	Remove ZoneIdentifier (JScript).js
	Removes Zone.Identifier from folder or selected files.

	Altap Salamander Automation Script.

	History
	~~~~~~~
	2010/3/29 - v1.0 - first version
*/

var scriptName = "Remove Zone.Identifier";
var Items = null;

if (Salamander.SourcePanel.SelectedItems.Count == 0) {
	// Select all items when .. is selected.
	if (Salamander.SourcePanel.FocusedItem.Name == "..") {
		Items = Salamander.SourcePanel.Items;
	}
} else {
	// Get selected items.
	Items = Salamander.SourcePanel.SelectedItems;
}

// Call Script for selected items or one file.
if (Items != null) {
	RemoveZoneIdentifiers(Items);
} else {
	var FullPath = Salamander.SourcePanel.FocusedItem.Path;
	if (RemoveZoneIdentifier(FullPath)==1) {
		Salamander.MsgBox("Zone.Identifier removed.",64,"Information");
	} else {
		Salamander.MsgBox("Zone.Identifier not found!",16,"Error");
	}
}

function RemoveZoneIdentifiers(Items) {
	var e = new Enumerator(Items);
	var count = 0;
	var sum = 0;

	for (; !e.atEnd(); e.moveNext())
	{
		var Item = e.item();
		// When item is a file remove the Zone.Identifier
		if (!(Item.Attributes&16)) {
			sum++;
		}
	}

	// Show the ProgressDialog
	Salamander.ProgressDialog.Title = scriptName;
	Salamander.ProgressDialog.Style = 1;
	Salamander.ProgressDialog.Maximum = sum;
	Salamander.ProgressDialog.Show();

	e.moveFirst();
	for (; !e.atEnd(); e.moveNext())
	{
		// Cancel if Button is pressed
		if (Salamander.ProgressDialog.IsCancelled) {
			break;
		}

		// Get the item and repaint Dialog
		var Item = e.item();
		Salamander.ProgressDialog.Step(1);
		Salamander.ProgressDialog.AddText("Removing "+Item.Name+":Zone.Identifier");
			
		// When item is a file remove the Zone.Identifier
		if (!(Item.Attributes&16)) {
			count = count + RemoveZoneIdentifier(Item.Path);
			sum++;
		}
	}

	Salamander.ProgressDialog.Hide();
	Salamander.SourcePanel.DeselectAll(true);
	Salamander.MsgBox(count+" Zone.Identifier removed.",64,"Information");
}

function RemoveZoneIdentifier(fileName) {
	var ZoneIdentifierName = fileName+":Zone.Identifier";
	var forReading = 1, forWriting = 2, forAppending = 8;

	fso = new ActiveXObject("Scripting.FileSystemObject");
	found = 1;
	try {
		f = fso.GetFile(ZoneIdentifierName);

		// Clear the Zone.Identifier file.
		clearZone = fso.CreateTextFile(ZoneIdentifierName,forWriting);
		clearZone.Close();
	} catch(e) {
		found = 0;
	}
	return found;
}
Last edited by murphy on 29 Mar 2010, 12:44, edited 1 time in total.
http://www.dev0.de / http://murphys.me
User avatar
th.
Posts: 116
Joined: 04 Sep 2006, 23:09
Location: Germany

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by th. »

There has always been the problem with the limitation of 10 Hot Paths.
Here are 2 workarounds with the help of the automation plugin.
Of course, all the names of directories, scripts and button labels are examples.

1. In one of the script directories create a subdirectory "Hot Paths".
In that directory create a script for each new Hot Path like this:

Code: Select all

'ham.vbs
Salamander.SourcePanel.Path = "D:\mail\ham"
Result:
ASHotPaths1.jpg
ASHotPaths1.jpg (31.08 KiB) Viewed 22852 times
You can even assign a hotkey to each item (in the Plugins Manager).

2. Use a script like this:

Code: Select all

' mhp.vbs
' More Hot Paths
' 29.03.2010 th.
Set Form1 = Salamander.Forms.Form("Where do you want to go today?")
Form1.b1 = Salamander.Forms.Button("&spam", 3)
Form1.b2 = Salamander.Forms.Button("&ham", 4)
Form1.b3 = Salamander.Forms.Button("&private", 5)
Form1.b4 = Salamander.Forms.Button("&confidential", 6)
Form1.b5 = Salamander.Forms.Button("cancel", 2)
Result = Form1.Execute
Path = ""
Select Case Result
Case 3
    Path = "D:\mail\spam"
Case 4
    Path = "D:\mail\ham"
Case 5
    Path = "D:\documents\private"
Case 6
    Path = "D:\documents\business\confidential"
End Select
If Path <> "" Then Salamander.SourcePanel.Path = Path
Result:
ASHotPaths2.jpg
ASHotPaths2.jpg (10.26 KiB) Viewed 22852 times
Note: The button sizes and positions cannot be controlled from the script, so there is a limitation in the number of buttons that can be displayed on the screen.
Last edited by th. on 09 Apr 2010, 22:14, edited 1 time in total.
User avatar
KNUT
Posts: 286
Joined: 12 Dec 2005, 09:57
Location: Hamburg, Germany

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by KNUT »

th. wrote:In the original post I have modified the script with the workaround by KNUT (permission assumed)
granted :)
Kind regards, KNUT
_____________________________________________
Satisfied Servant Salamander User from Version 1.5 till now
User avatar
th.
Posts: 116
Joined: 04 Sep 2006, 23:09
Location: Germany

Enhancement wishes

Post by th. »

While working on the infamous rename2date.vbs script I felt some enhancement wishes coming up like this:

1. The 2 cases of something being selected in the panel or not have to be handled differently now. I've collected all the "real work" in a subroutine, but it is still a hassle. It would be nice to have another collection in the panel object like "workset" that includes all selected items if there are any, otherwise the focused item except when it is the ".." item because you cannot do anything with it anyway (or can you?) That way, you just need a single loop to iterate through the items to be worked with.

2. The file attributes should be available as single properties, like "IsDirectory", "IsReadOnly" and so on. Bitmask juggling is a fine thing for every "real" coder but feels not right in a scripting environment in my opinion. :)

3. It would be nice if the filename part and the extension part were accessible as single properties.

4. All the date and time attributes should be available for read and write access (I'm having another script idea that needs that).

Furthermore, the form object and the controls are a little bit restrictive now. Are there any plans for more opportunities?

Thats all Folks! :wink: Hope you don't mind.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Jan Rysavy »

Thank you for your feedback and ideas!

For the first release of Automation plugin we focused on functionality that cannot be (easily) done directly in the scripting language, without support from Automation plugin. We are waiting for feedback from AS users to decide how to further improve Automation plugin.
User avatar
murphy
Posts: 10
Joined: 20 Dec 2005, 17:50

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by murphy »

Hi,

does someone know if it's possible to add DLL-Calls to the Automation Script Host?

Not an ActiveX Object. I know this is already possible.
But the new calls would make some scripts easier, since they can use a DLL for some calls.
Or you could implement a way to call a plugin which is installed in Altap Salamander.

Thanks for reading, murphy
http://www.dev0.de / http://murphys.me
p4ul
Posts: 13
Joined: 29 Mar 2010, 19:31

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by p4ul »

Hi, here is my contribution to the contest - Auto Rename v.1.1. It's regular expression rename utility, quite powerful.
AutoRename.gif
AutoRename.gif (5.98 KiB) Viewed 22762 times
Description:

Input pattern - regular expression, by default two brackets, first bracket matches name of the file and second bracket matches file extension
Output pattern - pattern for renaming: by default $1 is content matched by the first bracket in the input pattern - file name, $2 is the file extension here
Global match - find all matches rather than stopping after the first match
Case-insensitive matching - it's clear

Code: Select all

/* AutoRename v.1.0
 * (c) 2010 p4ul
 * 
 * Altap Salamander Automation Script
 * Licensed under MIT
 * 
 * History:
 * 30.03.2010 - v.1.1 - date added, directory support, bugs fixed    
 * 29.03.2010 - v.1.0 - first script version   
 */

var scriptName;
var inputPattern;
var outputPattern;
var modifiersGlobalMatch;
var modifiersCaseInsensitiveMatching;
var inputRegExp;
var fso;
var m = [];

// Script init
function Init()
{
	scriptName = 'Auto Rename v.1.1';
	inputPattern = '(.*)\\.([^\\.]*)$';
	outputPattern = '$1.$2';
	
	modifiersGlobalMatch = false;
	modifiersCaseInsensitiveMatching = true;	
	fso = new ActiveXObject('Scripting.FileSystemObject');

	m['$'] = [1, 1, 1, 1, 1, 1]; 
	m['i'] = [0, 2, 0, 2, 2, 0]; 
	m['d'] = [0, 5, 0, 0, 5, 0]; 
	m['0'] = [0, 4, 0, 3, 0, 0]; 
	m['1'] = [0, 3, 0, 3, 3, 0]; 
	m['2'] = [0, 3, 0, 3, 3, 0]; 
	m['3'] = [0, 3, 0, 3, 3, 0]; 
	m['4'] = [0, 3, 0, 3, 3, 0]; 
	m['5'] = [0, 3, 0, 3, 3, 0]; 
	m['6'] = [0, 3, 0, 3, 3, 0]; 
	m['7'] = [0, 3, 0, 3, 3, 0]; 
	m['8'] = [0, 3, 0, 3, 3, 0]; 
	m['9'] = [0, 3, 0, 3, 3, 0];	
}

// Indents text from left
function Indent(chr, totalCount, text)
{
	if (totalCount < 2 || totalCount <= text.length) return text;
	if (totalCount > 99) totalCount = 99;
	
	var cnt = parseInt(totalCount) - ('' + text).length;
	for (var i = 0; i < cnt; i++) text = chr + text;
	
	return text;
}

// Gets date
function GetDateString(chr, totalCount)
{
	var dt = new Date();
	return Indent(chr, totalCount, dt.getDate()) + '.' + Indent(chr, totalCount, ''+(1+dt.getMonth())) + '.' + dt.getFullYear();
}

// Replaces $i and $d entities 
function ProcessString(str, index)
{
	var state = 0, output = '', c, zero, num, prevState = 0, cache = '';
	for (var i = 0; i < str.length; i++)
	{
		c = str.charAt(i);
		if (m[c] != null) state = m[c][state]; else state = 0;
		if (state == 1) { output += cache; cache = ''; }
		cache += c;
		
		if (state == 1) { zero = false; num = ''; } // init
		if (state == 3) num += c; // number
		if (state == 4) zero = true; // zero

		if (state == 2) { output += Indent(zero ? '0' : ' ', num, index); state = 0; cache = ''; } // index
		if (state == 5) { output += GetDateString('0', zero ? 2 : 0); state = 0; cache = ''; } // date
	}
	if (cache.length > 0) output += cache;
		 
	return output; 
}

// Renames file name
function RenameFileName(index, originalFileName)
{
	var pattern = ProcessString(outputPattern, index);
	name = originalFileName.replace(inputRegExp, pattern);	

	return name;
}

// One file item processing
function ProcessItem(i, item)
{
	var newFileName = RenameFileName(i, item.Name);
	var f = (fso.FileExists(item.Path)) ? fso.GetFile(item.Path) : fso.GetFolder(item.Path);
	if (newFileName != f.name) f.name = newFileName;
}

// Selected file(s) processing
function ProcessSelected()
{
	try {
		var items = null;
		if (Salamander.SourcePanel.SelectedItems.Count == 0)
		{
			if (Salamander.SourcePanel.FocusedItem.Name != '..')
			{
				ProcessItem(0, Salamander.SourcePanel.FocusedItem);
			} else items = Salamander.SourcePanel.Items;
		} else items = Salamander.SourcePanel.SelectedItems;
	
		if (items != null)
		{	
			var i = 0;
			for (var itemsE = new Enumerator(items); !itemsE.atEnd(); itemsE.moveNext())
			{
				var item = itemsE.item();
				if (item.Name != '..') ProcessItem(i++, item);
			}
		}
	}
	catch(err)
	{
		Salamander.MsgBox('Unable to process the file(s)!\nError: ' + err.description, 64, scriptName);
	}
}

// Shows dialog
function ShowDialog()
{
	var fm = Salamander.Forms.Form(scriptName);
	fm.inputPatternLbl = Salamander.Forms.Label('Input pattern:');
	fm.inputPattern = Salamander.Forms.TextBox(inputPattern);
	fm.outputPatternLbl = Salamander.Forms.Label('Output pattern:');
	fm.outputPattern = Salamander.Forms.TextBox(outputPattern);
	fm.modifiersLbl = Salamander.Forms.Label('Modifiers:');
	fm.modifiersGlobalMatch = Salamander.Forms.CheckBox('Global match');
	fm.modifiersGlobalMatch.Checked = modifiersGlobalMatch;
	fm.modifiersCaseInsensitiveMatching = Salamander.Forms.CheckBox('Case-insensitive matching');
	fm.modifiersCaseInsensitiveMatching.Checked = modifiersCaseInsensitiveMatching;
	fm.okBtn = Salamander.Forms.Button("Ok", 1);
	fm.cancelBtn = Salamander.Forms.Button("Cancel", 2);
	
	while (true)
	{
		if (fm.Execute() == 1)
		{
			inputPattern = fm.inputPattern.Text;
			outputPattern = fm.outputPattern.Text;
			modifiersGlobalMatch = fm.modifiersGlobalMatch.Checked;
			modifiersCaseInsensitiveMatching = fm.modifiersCaseInsensitiveMatching.Checked; 

			var modifiers = '';
			if (modifiersGlobalMatch) modifiers += 'g';
			if (modifiersCaseInsensitiveMatching) modifiers += 'i';
			inputRegExp = new RegExp(inputPattern, modifiers);

			return true;
		}
		return false;
  }
}

// Entry function of automation script
function Main()
{
	Init();
	if (ShowDialog()) ProcessSelected();
}
Main();
Last edited by p4ul on 31 Mar 2010, 00:47, edited 1 time in total.
p4ul
Posts: 13
Joined: 29 Mar 2010, 19:31

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by p4ul »

Here are some tips & tricks with AutoRename v.1.1:

$i in the output pattern generates index number starts from 0 to number of selected files - 1, you can choose left indenting and 0 preceding:
$03i will develop to e.g.: 001
$02i will develop to e.g.: 01

$d in the output pattern generates date string in the format d.m.yyyy.
$0d generates date string in the format dd.mm.yyyy.

Here are some examples:

Adding file extension to files:
AutoRename-AddingFileExtension.png
AutoRename-AddingFileExtension.png (11.21 KiB) Viewed 22758 times
Adding index to files:
AutoRename-AddingIndexToFiles.png
AutoRename-AddingIndexToFiles.png (10.7 KiB) Viewed 22758 times
Removing file extension:
AutoRename-RemovingExtension.png
AutoRename-RemovingExtension.png (10.62 KiB) Viewed 22758 times
p4ul
Posts: 13
Joined: 29 Mar 2010, 19:31

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by p4ul »

Hi, I've released AutoRename script version 1.2:

What is new:
* Persistence - values are saved before exiting and loaded on the script startup
* Index starts from 1 - I think, it's more practical to start from 1 and not 0
* Default input pattern changed - now you can add simply prefix and postfix to name and extension without changing Input pattern, e.g.: name.txt with output pattern ($1).($2) will rename file to: (name).(txt). It wasn't possible in previous version.
* Message when input pattern is wrong

I encountered the crash of Salamander sometimes what was described before my post and value persistence ddin't work for me. So probably it's caused by Automation bug.

Code: Select all

/* AutoRename v.1.2
 * (c) 2010 p4ul
 * 
 * Altap Salamander Automation Script
 * Licensed under MIT
 * 
 * History:
 * 31.03.2010 - v.1.2 - persistence, index starts from 1 now, default input pattern changed
 * 30.03.2010 - v.1.1 - date added, directory support, bugs fixed    
 * 29.03.2010 - v.1.0 - first script version   
 */

var scriptName;
var inputPattern;
var outputPattern;
var modifiersGlobalMatch;
var modifiersCaseInsensitiveMatching;
var inputRegExp;
var fso;
var m = [];

// Script init
function Init()
{
	scriptName = 'Auto Rename v.1.2';
	inputPattern = '(.*)\\.(.*)';
	outputPattern = '$1.$2';
	
	modifiersGlobalMatch = false;
	modifiersCaseInsensitiveMatching = true;	
	fso = new ActiveXObject('Scripting.FileSystemObject');

	m['$'] = [1, 1, 1, 1, 1, 1]; 
	m['i'] = [0, 2, 0, 2, 2, 0]; 
	m['d'] = [0, 5, 0, 0, 5, 0]; 
	m['0'] = [0, 4, 0, 3, 0, 0]; 
	m['1'] = [0, 3, 0, 3, 3, 0]; 
	m['2'] = [0, 3, 0, 3, 3, 0]; 
	m['3'] = [0, 3, 0, 3, 3, 0]; 
	m['4'] = [0, 3, 0, 3, 3, 0]; 
	m['5'] = [0, 3, 0, 3, 3, 0]; 
	m['6'] = [0, 3, 0, 3, 3, 0]; 
	m['7'] = [0, 3, 0, 3, 3, 0]; 
	m['8'] = [0, 3, 0, 3, 3, 0]; 
	m['9'] = [0, 3, 0, 3, 3, 0];	
}

// Indents text from left
function Indent(chr, totalCount, text)
{
	if (totalCount < 2 || totalCount <= text.length) return text;
	if (totalCount > 99) totalCount = 99;
	
	var cnt = parseInt(totalCount) - ('' + text).length;
	for (var i = 0; i < cnt; i++) text = chr + text;
	
	return text;
}

// Gets date
function GetDateString(chr, totalCount)
{
	var dt = new Date();
	return Indent(chr, totalCount, dt.getDate()) + '.' + Indent(chr, totalCount, ''+(1+dt.getMonth())) + '.' + dt.getFullYear();
}

// Replaces $i and $d entities 
function ProcessString(str, index)
{
	var state = 0, output = '', c, zero, num, prevState = 0, cache = '';
	for (var i = 0; i < str.length; i++)
	{
		c = str.charAt(i);
		if (m[c] != null) state = m[c][state]; else state = 0;
		if (state == 1) { output += cache; cache = ''; }
		cache += c;
		
		if (state == 1) { zero = false; num = ''; } // init
		if (state == 3) num += c; // number
		if (state == 4) zero = true; // zero

		if (state == 2) { output += Indent(zero ? '0' : ' ', num, (index + 1)); state = 0; cache = ''; } // index
		if (state == 5) { output += GetDateString('0', zero ? 2 : 0); state = 0; cache = ''; } // date
	}
	if (cache.length > 0) output += cache;
		 
	return output; 
}

// Renames file name
function RenameFileName(index, originalFileName)
{
	var pattern = ProcessString(outputPattern, index);
	name = originalFileName.replace(inputRegExp, pattern);	

	return name;
}

// One file item processing
function ProcessItem(i, item)
{
	var newFileName = RenameFileName(i, item.Name);
	var f = (fso.FileExists(item.Path)) ? fso.GetFile(item.Path) : fso.GetFolder(item.Path);
	if (newFileName != f.name) f.name = newFileName;
}

// Selected file(s) processing
function ProcessSelected()
{
	try {
		var items = null;
		if (Salamander.SourcePanel.SelectedItems.Count == 0)
		{
			if (Salamander.SourcePanel.FocusedItem.Name != '..')
			{
				ProcessItem(0, Salamander.SourcePanel.FocusedItem);
			} else items = Salamander.SourcePanel.Items;
		} else items = Salamander.SourcePanel.SelectedItems;
	
		if (items != null)
		{	
			var i = 0;
			for (var itemsE = new Enumerator(items); !itemsE.atEnd(); itemsE.moveNext())
			{
				var item = itemsE.item();
				if (item.Name != '..') ProcessItem(i++, item);
			}
		}
	}
	catch(err)
	{
		Salamander.MsgBox('Unable to process the file(s)!\nError: ' + err.description, 16, scriptName);
	}
}

// Loads settings
function LoadSettings()
{
	var val;
	val = Salamander.GetPersistentVal("AutoRename.InputPattern"); if (val != null) inputPattern = val;
	val = Salamander.GetPersistentVal("AutoRename.OutputPattern"); if (val != null) outputPattern = val;
	val = Salamander.GetPersistentVal("AutoRename.MGlobalMatch"); if (val != null) modifiersGlobalMatch = val == 1 ? true : false;
	val = Salamander.GetPersistentVal("AutoRename.MCaseInsensitiveMatching"); if (val != null) modifiersCaseInsensitiveMatching = val == 1 ? true : false;
}

// Saves settings
function SaveSettings()
{
	Salamander.SetPersistentVal("AutoRename.InputPattern", inputPattern);
	Salamander.SetPersistentVal("AutoRename.OutputPattern", outputPattern);
	Salamander.SetPersistentVal("AutoRename.MGlobalMatch", modifiersGlobalMatch ? 1 : 0);
	Salamander.SetPersistentVal("AutoRename.MCaseInsensitiveMatching", modifiersCaseInsensitiveMatching ? 1 : 0);
}

// Shows dialog
function ShowDialog()
{
	var fm = Salamander.Forms.Form(scriptName);
	fm.inputPatternLbl = Salamander.Forms.Label('Input pattern:');
	fm.inputPattern = Salamander.Forms.TextBox(inputPattern);
	fm.outputPatternLbl = Salamander.Forms.Label('Output pattern:');
	fm.outputPattern = Salamander.Forms.TextBox(outputPattern);
	fm.modifiersLbl = Salamander.Forms.Label('Modifiers:');
	fm.modifiersGlobalMatch = Salamander.Forms.CheckBox('Global match');
	fm.modifiersGlobalMatch.Checked = modifiersGlobalMatch;
	fm.modifiersCaseInsensitiveMatching = Salamander.Forms.CheckBox('Case-insensitive matching');
	fm.modifiersCaseInsensitiveMatching.Checked = modifiersCaseInsensitiveMatching;
	fm.okBtn = Salamander.Forms.Button("Ok", 1);
	fm.cancelBtn = Salamander.Forms.Button("Cancel", 2);

	while (true)
	{	
		if (fm.Execute() == 1)
		{
			inputPattern = fm.inputPattern.Text;
			outputPattern = fm.outputPattern.Text;
			modifiersGlobalMatch = fm.modifiersGlobalMatch.Checked;
			modifiersCaseInsensitiveMatching = fm.modifiersCaseInsensitiveMatching.Checked; 
			var modifiers = '';
			if (modifiersGlobalMatch) modifiers += 'g';
			if (modifiersCaseInsensitiveMatching) modifiers += 'i';
			
			try {
				inputRegExp = new RegExp(inputPattern, modifiers);
			}
			catch(err)
			{
				Salamander.MsgBox('Input pattern is wrong (check it for missing brackets for instance)!', 64, scriptName);
				continue;
			}

			SaveSettings();
			return true;
		}
		return false;
	}
}

// Entry function of automation script
function Main()
{
	Init();
	LoadSettings();
	if (ShowDialog()) ProcessSelected();
}
Main();
p4ul
Posts: 13
Joined: 29 Mar 2010, 19:31

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by p4ul »

Hi again, I've developed set of scripts called Management Tools.

It's set of useful shortcuts to main management windows in the system. Look at the following picture:
ManagementTools.png
ManagementTools.png (5.95 KiB) Viewed 22727 times
How to install:
Download following zip file, extract it and move the Management Tools folder to C:\Program Files\Altap Salamander (beta)\plugins\automation\scripts folder. Then you will have this set of scripts working. Try to use ctrl+shift+a as shortcut to automation context window and you will be fast in managing OS!
Management Tools.zip
(3.07 KiB) Downloaded 721 times
All shortcuts were tested and are working on Windows XP Home and Windows 7.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Jan Rysavy »

Thank you for participating in this Contest and thank you for your scripts!

We decided to give Altap Salamander lifetime licenses to all participants :wink:

Please contact me on jan.rysavy@altap.cz and provide us your home address and full name so we can issue your registration key.
Use the same email you registered on this forum.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Jan Rysavy »

All registration keys are out. Please contact me if you didn't receive it (check also your spam folder).
Post Reply