Page 1 of 4
Automation Script Contest: 3 Free Salamander Licenses
Posted: 17 Feb 2010, 14:08
by Jan Rysavy
Have you already noticed Manison's
Automation plugin for Altap Salamander?
We are excited to announce that Automation plugin is now included in Altap Salamander distribution.
Now you have a chance win free lifetime license of Altap Salamander including all plugins!
We are just launching a contest.
How to join
To enter the contest, simply download and install latest
Altap Salamander 2.53 beta 1, and write some useful script within the Automation plugin. Publish it on this forum and let Altap Salamander users to decide by voting. Win free lifetime license for you or for your friend (if you already have one).
Rules
- Time frame: from 2/17/2010 to 3/31/2010 for creating scripts, 4/1/2010 to 4/15/2010 for voting
- Altap Salamander users choose the winners
- Winners will be announced on 4/16/2010
- Scripts must be implemented in JScript (.js) or VBScript (.vbs) and use Automation plugin interface, see Automation help for API documentation and plugins\automation\scripts directory for sample scripts
- Scripts must be released with MIT license, see our Convert Images.js or Unpack Multiple Archives.js samples
- Multiple versions of the script could be published and discussed here
- One participant can publish more scripts but can win only one license (when first two scripts will be from the same author, also authors of the third and fourth script will win)
- Altap employees cannot participate in this contest but can vote
- Feel free to ask if you have any questions or problems with Automation plugin
Good luck to everyone and have fun
Post updates
02/17/2010: Initial post.
03/05/2010: Altap Salamander 2.53 beta 1 is linked instead of Preview Build (EAP) version.
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 18 Feb 2010, 01:04
by Jan Rysavy
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 08 Mar 2010, 15:52
by kbirger
Hi. Do you mean for us to post the scripts we submit in this thread, or just anywhere in the General Discussion board? (I just don't see any other submissions)
Also, is it limited to one script submitted per user?
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 08 Mar 2010, 16:07
by Jan Rysavy
Hi, feel free to use this thread. You would be probably the first submitter
Please include a brief description of the script and how should we use it.
One user can submit multiple scripts, but can win only one AS license in case when more of these scripts will be rated in first three positions. In such case submitter on position 4. (and 5.) will also win.
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 08 Mar 2010, 18:25
by JohnFredC
Hi Jan...
I have a script to post but don't care about the disclaimer part. Is it OK to post a script (as text embedded in a forum posting) without including all that legalese in the comments?
The script is just a "demo" or example and has no pretensions to be anything important or competitive.
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 08 Mar 2010, 18:35
by Jan Rysavy
Hi John, it's not a problem. The idea behind this contest was to let Altap Salamander users know about new Automation plugin, get some feedback and ideas, and have a fun
All scripts, ideas, bug reports, questions, or other feedback are welcome!
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 16 Mar 2010, 09:12
by otrov
I made simple script which outputs some data to .csv file. Then calling:
opens internal viewer instead associated database viewer. Why?
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 16 Mar 2010, 09:47
by Jan Rysavy
otrov wrote:Salamander.ViewFile(csv_file) opens internal viewer instead associated database viewer. Why?
There is a bug in Automation plugin documentation. Currently only internal Salamander text/bin viewer could be opened from Automation.
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 26 Mar 2010, 00:03
by th.
Based on an idea over there:
http://forum.altap.cz/viewtopic.php?f=3&t=1558&start=0
Modified to remove the regional settings dependency (thanks to KNUT) + cleanup + better script name
Code: Select all
' append date.vbs
' Append the current date to the name of the focused/selected files and directories
' 29.03.2010 th.
'
Dim Fso, Item, OverwriteAnswer, YMD, NewSuffix
Set Fso = CreateObject("Scripting.FileSystemObject")
YMD = ( Year(Date)*100 + Month(Date) )*100 + Day(Date)
' The string that will be added to the old filename: "_2010-03-29"
NewSuffix = "_" & mid(YMD, 1, 4) & "-" & mid(YMD, 5, 2) & "-" & mid(YMD, 7, 2)
OverwriteAnswer = 0
'--- Identify the item(s) to rename
If Salamander.SourcePanel.SelectedItems.Count = 0 Then ' nothing selected
If Salamander.SourcePanel.FocusedItem.Name <> ".." then
RenameItem Salamander.SourcePanel.FocusedItem, False
Else
Salamander.MsgBox "Please select or focus an item first.",0,"Rename2date"
Salamander.AbortScript()
End If
Else ' something is selected
'--- Set up progress dialog
Salamander.ProgressDialog.Style = 1
Salamander.ProgressDialog.Maximum = Salamander.SourcePanel.SelectedItems.Count
Salamander.ProgressDialog.Show
Salamander.ProgressDialog.AddText "Renaming ..."
' Iterate through the selected items collection, rename each item
For Each Item In Salamander.SourcePanel.SelectedItems
RenameItem Item, True
If Salamander.ProgressDialog.IsCancelled then Salamander.AbortScript() ' Cancelled
Next
End If
Sub RenameItem(Item, ShowProgress)
Dim Overwrite, IsDirectory, OldFilename, OldName, OldExtension, NewFilename
IsDirectory = (Item.Attributes And 16) <> 0
OldFilename = Salamander.GetFullPath(Item.Name, Salamander.SourcePanel)
SplitFilenameAndExtension Item.Name, OldName, OldExtension
' Build the new name for the item
NewFilename = Salamander.GetFullPath(OldName & NewSuffix, Salamander.SourcePanel)
If OldExtension <> "" Then NewFilename = NewFilename & "." & OldExtension
If ShowProgress Then
Salamander.ProgressDialog.Step(1)
Salamander.ProgressDialog.AddText vbCrLf & OldFilename & " --> " & NewFilename
End If
Overwrite = True
If Fso.FileExists(NewFilename) Then
'if neither "skip all" nor "all" has been pressed before, ask
If OverwriteAnswer < 17 then _
OverwriteAnswer = Salamander.OverwriteDialog(Fso.GetFile(NewFilename), Fso.GetFile(OldFilename), 4)
Select Case OverwriteAnswer
Case 2
Salamander.AbortScript() ' Cancel
Case 7, 16, 17
Overwrite = False
Case Else ' Overwrite, target has to be deleted
If IsDirectory then
Fso.DeleteFolder NewFilename
Else
Fso.DeleteFile NewFilename
End If
End Select
End If
If Overwrite then
If IsDirectory Then
Fso.MoveFolder OldFilename, NewFilename
Else
Fso.MoveFile OldFilename, NewFilename
End If
End If
End Sub
Sub SplitFilenameAndExtension(FileName, Name, Extension)
Dim n
For n = Len(FileName) to 1 step -1
If Mid(FileName, n, 1) = "." Then Exit For
Next
if n < 1 then
Name = FileName
Extension = ""
Else
Name = Left(FileName, n - 1)
Extension = Mid(FileName, n + 1)
End If
End Sub
Documentation error
Posted: 26 Mar 2010, 00:09
by th.
There seems to be an error in the documentation of the OverwriteDialog Method.
The dialog is asking "Overwrite file1 with file2?"
Re: Documentation error
Posted: 26 Mar 2010, 10:03
by Jan Rysavy
th. wrote:There seems to be an error in the documentation of the OverwriteDialog Method.
The dialog is asking "Overwrite file1 with file2?"
Fixed. Thank you
Re: rename2date.vbs
Posted: 26 Mar 2010, 16:43
by Georgd
it crashes whole Salamander 2.53b1 on fresh Win7 64bit here
Bug report comes via PM.
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 26 Mar 2010, 16:43
by KNUT
Does not work properly here:
Test_010-3.-26.txt
My workaround:
Code: Select all
...
YMD = ( Year(Date)*100 + Month(Date) )*100 + Day(Date)
NewFilename = Salamander.SourcePanel.Path & "\" & _
OldName & "_" & mid(YMD,1,4) & "-" & mid(YMD,5,2) & "-" & mid(YMD,7,2)
...
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 26 Mar 2010, 16:59
by Georgd
KNUT wrote:My workaround:
Crashes Salamander, too
Re: Automation Script Contest: 3 Free Salamander Licenses
Posted: 26 Mar 2010, 18:13
by KNUT
Georgd wrote:KNUT wrote:My workaround:
Crashes Salamander, too
No crash! Works fine here:
Code: Select all
' rename2date.vbs
' Rename the current/selected files and directories by adding the current date
' 25.03.2010 th.
'
Dim Items
Dim Fso, Item, OverwriteAnswer, Overwrite
Set Fso = CreateObject("Scripting.FileSystemObject")
OverwriteAnswer = 0
'--- Identify the item(s) to rename
If Salamander.SourcePanel.SelectedItems.Count = 0 Then
If Salamander.SourcePanel.FocusedItem.Name <> ".." then
RenameItem Salamander.SourcePanel.FocusedItem, False
Else
Salamander.MsgBox "Please select or focus an item first.",0,"Rename"
Salamander.AbortScript()
End If
Else
Set Items = Salamander.SourcePanel.SelectedItems
End If
If VarType(Items) <> 0 Then ' vbEmpty
'--- Set up progress dialog
Salamander.ProgressDialog.Style = 1
Salamander.ProgressDialog.Maximum = Items.Count
Salamander.ProgressDialog.Show
Salamander.ProgressDialog.AddText "Renaming ..."
' Iterate through the item collection rename each item
For Each Item In Items
RenameItem Item, True
If Salamander.ProgressDialog.IsCancelled then Salamander.AbortScript() ' Canceled
Next
End If
Sub RenameItem(Item, ShowProgress)
If Item.Name <> ".." Then
IsDirectory = (Item.Attributes And 16) <> 0
OldFilename = Salamander.SourcePanel.Path & "\" & Item.Name
SplitFilenameAndExtension Item.Name, OldName, OldExtension
' Build the new name for the item - this has to be adapted!
YMD = ( Year(Date)*100 + Month(Date) )*100 + Day(Date)
NewFilename = Salamander.SourcePanel.Path & "\" & _
OldName & "_" & mid(YMD,1,4) & "-" & mid(YMD,5,2) & "-" & mid(YMD,7,2)
' OldName & "_" & mid(date,7,4) & "-" & mid(date,4,2) & "-" & mid(date,1,2)
If OldExtension <> "" Then NewFilename = NewFilename & "." & OldExtension
If ShowProgress Then
Salamander.ProgressDialog.Step(1)
Salamander.ProgressDialog.AddText vbCrLf & OldFilename & " --> " & NewFilename
End If
Overwrite = True
If Fso.FileExists(NewFilename) Then
'neither "skip all" nor "all" has been pressed before, ask
If OverwriteAnswer < 17 then _
OverwriteAnswer = Salamander.OverwriteDialog(NewFilename, OldFilename, 4)
Select Case OverwriteAnswer
Case 2
Salamander.AbortScript() ' Cancel
Case 7, 16, 17
Overwrite = False
Case Else ' Overwrite, target has to be deleted
If IsDirectory then
Fso.DeleteFolder NewFilename
Else
Fso.DeleteFile NewFilename
End If
End Select
End If
If Overwrite then
If IsDirectory Then
Fso.MoveFolder OldFilename, NewFilename
Else
Fso.MoveFile OldFilename, NewFilename
End If
End If
End If
End Sub
Sub SplitFilenameAndExtension(FileName, Name, Extension)
Dim n
For n = Len(FileName) to 1 step -1
If Mid(FileName, n, 1) = "." Then Exit For
Next
if n < 1 then
Name = FileName
Extension = ""
Else
Name = Left(FileName, n - 1)
Extension = Mid(FileName, n + 1)
End If
End Sub