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.
User avatar
murphy
Posts: 10
Joined: 20 Dec 2005, 17:50

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by murphy » 08 Apr 2010, 13:50

Jan Rysavy wrote:All registration keys are out. Please contact me if you didn't receive it (check also your spam folder).
I got mine. Thanks Thanks Thanks. Very cool. :D
http://www.dev0.de / http://murphys.me

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 » 08 Apr 2010, 13:51

Jan Rysavy wrote:All registration keys are out. Please contact me if you didn't receive it (check also your spam folder).
:D Thanks!! :P
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

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by th. » 08 Apr 2010, 15:36

Thanks a lot! 8)

p4ul
Posts: 13
Joined: 29 Mar 2010, 19:31

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by p4ul » 14 Apr 2010, 19:54

I got mine too. Thanks Jan!

Syl
Posts: 2
Joined: 21 Aug 2010, 23:52

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Syl » 24 Aug 2010, 13:42

These scripts are really great :)
Is it planned to have a database on the official website ?

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Jan Rysavy » 24 Aug 2010, 13:47

It would be nice, but we would need maintainer.

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 » 26 Aug 2010, 13:57

Jan Rysavy wrote:It would be nice, but we would need maintainer.
What's about a simple Wiki? :?
Kind regards, KNUT
_____________________________________________
Satisfied Servant Salamander User from Version 1.5 till now

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Jan Rysavy » 26 Aug 2010, 14:19

Such list could be maintained on this forum, there is option to edit own posts. See for example this post: http://forum.altap.cz/viewtopic.php?f=23&t=3959#p19820

Wiki could be next step.

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by Jan Rysavy » 30 Aug 2010, 07:36

New script idea: Recursive File/Directory list.
Could be based on existing C:\Program Files (x86)\Altap Salamander\plugins\automation\scripts\Count Lines.js (for example).

User avatar
KNUT
Posts: 286
Joined: 12 Dec 2005, 09:57
Location: Hamburg, Germany

NEW SCRIPT: rename2filedate.vbs

Post by KNUT » 30 Aug 2010, 17:44

Append the filedate (NOT the current date!) to the selected file.

Code: Select all

    ' rename2date.vbs
    ' Rename the current/selected files and directories by adding the 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
             'Salamander.MsgBox Item.DateLastModified
             SplitFilenameAndExtension Item.Name, OldName, OldExtension
             ' Build the new name for the item - this has to be adapted!
             YMD = Item.DateLastModified
             YMD1 = InStr (1, YMD, ".")
             YMD2 = InStr (YMD1+1, YMD, ".")
             YMDMON = "0" & mid(YMD,YMD1+1,YMD2-YMD1-1)
             YMDDAY = "0" & mid(YMD,1,YMD1-1)
             'Salamander.MsgBox YMD & "#" & YMD1 & "#" & YMD2 & "#" & YMDDAY & "#" & YMDMON
             NewFilename = Salamander.SourcePanel.Path & "\" & _
             OldName & "_" & mid(YMD,YMD2+1,4) & "-" & Right(YMDMON,2) & "-" & Right(YMDDAY,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
Attachments
rename2filedate.txt
(3.91 KiB) Downloaded 333 times
Kind regards, KNUT
_____________________________________________
Satisfied Servant Salamander User from Version 1.5 till now

User avatar
KNUT
Posts: 286
Joined: 12 Dec 2005, 09:57
Location: Hamburg, Germany

NEW SCRIPT: renameorcopy2filedate.vbs

Post by KNUT » 31 Aug 2010, 10:48

Another dirty 8) hack: rename OR copy 2 filedate...

Code: Select all

    ' rename2date.vbs
    ' Rename the current/selected files and directories by adding the date
    ' 25.03.2010 th.
    ' 31.08.2010 KNUT
    Dim Items
    Dim Fso, Item, OverwriteAnswer, Overwrite

    Set Fso = CreateObject("Scripting.FileSystemObject")

    OverwriteAnswer = 0

    'Copy or rename
    Set Form1 = Salamander.Forms.Form("Only Rename or Copy to an new file?")
    Form1.b1 = Salamander.Forms.Button("&Copy", 3)
    Form1.b2 = Salamander.Forms.Button("&Rename", 4)
    Result = Form1.Execute
    Select Case Result
    Case 3
        DOCOPY = True
    Case 4
        DOCOPY = False
    End Select
    If Path <> "" Then DOCOPY = False

    '--- 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
             'Salamander.MsgBox Item.DateLastModified
             SplitFilenameAndExtension Item.Name, OldName, OldExtension
             ' Build the new name for the item - this has to be adapted!
             YMD = Item.DateLastModified
             YMD1 = InStr (1, YMD, ".")
             YMD2 = InStr (YMD1+1, YMD, ".")
             YMDMON = "0" & mid(YMD,YMD1+1,YMD2-YMD1-1)
             YMDDAY = "0" & mid(YMD,1,YMD1-1)
             'Salamander.MsgBox YMD & "#" & YMD1 & "#" & YMD2 & "#" & YMDDAY & "#" & YMDMON
             NewFilename = Salamander.SourcePanel.Path & "\" & _
             OldName & "_" & mid(YMD,YMD2+1,4) & "-" & Right(YMDMON,2) & "-" & Right(YMDDAY,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 DOCOPY then
                If IsDirectory Then
                   Fso.CopyFolder OldFilename, NewFilename
                Else
                   Fso.CopyFile OldFilename, NewFilename
                End If
              Else
                If IsDirectory Then
                   Fso.MoveFolder OldFilename, NewFilename
                Else
                   Fso.MoveFile OldFilename, NewFilename
                End If
              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
Attachments
renameorcopy2filedate.txt
(4.57 KiB) Downloaded 336 times
Kind regards, KNUT
_____________________________________________
Satisfied Servant Salamander User from Version 1.5 till now

fraktik
Posts: 206
Joined: 27 Apr 2007, 12:13
Location: cz
Contact:

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by fraktik » 26 Feb 2011, 11:59

Ahoj soutěžci (hezký tvar, ne? ;-) ), velké díky tvůrcům AS (aneb něco chci a tak začínám podkuřovat :wink: ):

Už dlouho jsem se chystal zprovoznit "Image Resize script" dle vlákna Convert Images automation plugin, zkusil jsem ho pustit ale hned cosi zařval (dohledáno třeba zde: PB44: Automation plugin a externi program), tak jsem si tedy stáhl a nainstaloval utilitku [url=http://image_magick.veidrodis.com/image_magick/windows/ImageMagick-windows.zip]ImageMagic[/url] (nechápu proč nemají na stránkách přímé odkazy na instalátor a člověk se musí brodit celým jejich mirrorem).
Ještě před ruční editací skriptu C:\Program Files\Altap Salamander 2.53\plugins\automation\scripts\Convert Images.js jsem si ho zkusil pustit jen tak - a byl velice příjemně překvapen, že se umí sám zeptat na cestu k prográmku).

Ovšem tím příjemná překvapení skončila:
Je zde zřejmě sice možnost nějakého rekurznivního vnoření se do adresářové struktury, ale GUI nenabízí prakticky žádné možnosti + upravená fotka přišla o Exif info (zjištěno jen náhodou (Landscape místo Portrét zobrazení náhledu)) - i přestože dle BUG: convert 6.5 -resize looses EXIF tag XResolution by to už přes rok mělo být vyřešeno (stáhnul jsem nejnovější versi z 2011-02-13, tj. 6.6.7-7).
Navíc pokud pustím na totožný obrázek Irfan View, ušetřím (při nastavení 50% kvality - tento posuvník (či číselná hodnota) by byl pro skript mým ideálem) 88% místa. I samotný PictView to zvládá (automaticky a bez zřejmé možnosti nastavení) na 75% původní velikosti (tj. ale dvojnásobná oproti Irfanu), zatímco tento skript vygeneruje jen soubor poloviční velikosti oproti původnímu... :-/\
Když jsem ho snižováním "-quality" parametru (až na pouhých 25) donutil dojít na stejnou velikost souboru, vykazoval daleko větší "zubatost" + se navíc snížilo i celkové rozlišení...

Velice příjemná by byla i možnost zachování původního data ve vlastnostech obrázků.

Našla by se tedy (prosím prosím) dobrá duše, která by mi poradila jak změnit onen řádek:

Code: Select all

var imageMagickParams = "-resample 100x100 -quality 80";
dle mých představ? :roll:

Edit:
Ether tu několíkráte zmiňoval (nesrovnatelně menší) utilitku NConvert - uměl by ji případně někdo někdo "zasekat" do "ImageResizeScriptu"?

User avatar
otrov
Posts: 110
Joined: 10 Feb 2010, 04:39

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by otrov » 16 Jun 2011, 19:10

Python Automation Script: "Imgur Upload.pys"

Tested on Python 2.6.6. Should work with later Python version also. Python 2.5 would need "json" module IIRC
Uses Standard Python Library, although http://sourceforge.net/projects/pywin32/ is needed for COM magic to work (or Active Python distribution)

OK. Those were boring facts which shouldn't make a difference in most cases.

Script itself: http://pastebin.com/BhLaVpX4
Download: http://pastebin.com/download.php?i=BhLaVpX4

When evoked it would try to upload current focused file, then provide various links

In action:

Image

Image

User avatar
otrov
Posts: 110
Joined: 10 Feb 2010, 04:39

Re: Automation Script Contest: 3 Free Salamander Licenses

Post by otrov » 16 Jun 2011, 20:15

Have a question also :)

Does Salamander COM object exist to be called with Dispatch i.e.?
I tried "win32com.client.Dispatch('Salamander.Application')", but nothing
I browser available ProgIDs but couldn't find anything related to Altap or Salamander or Automation

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 » 19 Jun 2011, 12:05

otrov wrote:Does Salamander COM object exist to be called with Dispatch i.e.?
I tried "win32com.client.Dispatch('Salamander.Application')", but nothing
I browser available ProgIDs but couldn't find anything related to Altap or Salamander or Automation
The Salamander object is not available outside the Automation script, it's only accessible through the Salamander global variable. You cannot instantiate it using Dispatch or any other mechanism the language provides. What are you trying to do?

Post Reply