Hi,
I like to get a list of all EXE/DLL files in the selected folder with the file version. As AS doesn't support this right now, I was wondering if this could be accomplished with a automation script which then can be started with a shortcut key or button.
If someone could give me an example working script then that would be very appreciated!
Marc
Example automation script for list files with file version
-
- Posts: 6
- Joined: 31 Dec 2010, 13:33
Re: Example automation script for list files with file versi
Hi Marc,
Here's a modification of the "Make list" VBS example script for you.
Here's a modification of the "Make list" VBS example script for you.
Code: Select all
'
' Make List (VBScript).vbs
' Creates the CSV list from the selected items.
'
' Sample Altap Salamander Automation Script.
'
' www.manison.cz
'
' file version column added th. 21.09.2012
Dim Items
' Pick the collection of items to make the list from.
If Salamander.SourcePanel.SelectedItems.Count = 0 Then
If Salamander.MsgBox("No items are selected. Do you want to make list from all items in the panel?", 4, "Question") = 6 Then
Set Items = Salamander.SourcePanel.Items
End If
Else
Set Items = Salamander.SourcePanel.SelectedItems
End If
If VarType(Items) <> 0 Then ' vbEmpty
Dim Fso, WshShell, ListName, Item, File
Set Fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
' Open the target file.
ListName = WshShell.ExpandEnvironmentStrings("%TEMP%\FileList.csv")
Set File = Fso.CreateTextFile(ListName, True)
' Write down the header.
File.WriteLine("Name;Size;Date;Attributes;Version")
' Iterate through the item collection and record info about each of them into the file.
For Each Item In Items
If Item.Name <> ".." Then
File.WriteLine(Item.Name & ";" & Item.Size & ";" & Item.DateLastModified & ";" & Item.Attributes & ";" & fso.GetFileVersion(Item.Path))
End If
Next
' Close the file.
File.Close
' Deselect all items that could be eventually selected.
Salamander.SourcePanel.DeselectAll
' Focus created file in the other panel.
Salamander.TargetPanel.Path = ListName
If Salamander.MsgBox("List " & ListName & " was successfully created. Do you want to open it now?", 4, "Finished") = 6 Then
' Open newly created list in the associated application.
WshShell.Run(ListName)
End If
End If
Re: Example automation script for list files with file versi
If there is a standard way to access the version resource through an ActiveX component, building the list should be straight forward. For how to process the selected or focused panel item(s) see the example scripts.
However, AS automation script does not provide any GUI element to present the list. I once made an attempt to overcome this limitation by using HTA (html, JScript based dynamic web page presented as a local application window); see SpecialFolders Automation Script for more information and source.
To present your list, AS's Database Viewer was a good choice, only there's no API way to launch it.
So you either need to just create a file containing the info for separate visitation or use an external viewer (e.g. Notepad.exe) to view your data. To do so, you can either use a file to buffer the data or use some automation (sending key strokes/windows messages or ActiveX). There are many examples for using IE automation from WSH scripts on the net.
However, AS automation script does not provide any GUI element to present the list. I once made an attempt to overcome this limitation by using HTA (html, JScript based dynamic web page presented as a local application window); see SpecialFolders Automation Script for more information and source.
To present your list, AS's Database Viewer was a good choice, only there's no API way to launch it.
So you either need to just create a file containing the info for separate visitation or use an external viewer (e.g. Notepad.exe) to view your data. To do so, you can either use a file to buffer the data or use some automation (sending key strokes/windows messages or ActiveX). There are many examples for using IE automation from WSH scripts on the net.
-
- Posts: 6
- Joined: 31 Dec 2010, 13:33
Re: Example automation script for list files with file versi
Thx.th. wrote:Hi Marc,
Here's a modification of the "Make list" VBS example script for you.