Jump to content
Ketarin forum
jusseppe

New Version / Old Version Column

Recommended Posts

Hello everybody,

I don't find anyone saying anything about the possibility to have a custom column that shows you right away a comparison between the version of the applications you have on your HDD and the new one that has been verified by Ketarin. Something like the screenshot in the attachment. Am I missinf something or is it seen as a non-relevant feature?

post-10055-0-51840800-1466942927_thumb.jpg

Share this post


Link to post
Share on other sites

I was more thinking of having three version columns:

  1. "installed"
  2. "stored/archived" i.e. downloaded and stored on disk
  3. "latest" available for download

Share this post


Link to post
Share on other sites

wouldn't it be possible to simply store the "version" variable which is the last version you downloaded in the "oldversion" variable?

eg.

string oldversion = version;


/* This stores the "old" version (based on last download) into the Website field */
app.WebsiteUrl = oldversion;

where version would be the variable (and default column) you use to define the latest version available by parsing the download sites?

I tried it like that but for some reason it seems not to be working...

Share this post


Link to post
Share on other sites

Hi jusseppe, I attempted a solution you can find below. 

 

It works, however there are various corner-cases that can confuse it. 

 

I made attempts to anticipate and avoid those confusions(I excluded them from what follows), however I could not do it to my satisfaction. The life-cycle of Ketarin url-variables makes this difficult, specifically :

1. Url-variables are updated first, and provided as such to both pre and post download commands(without access to the previous)

2. Regular-expression-url-variables, will not update at all, unless explicitly used within a job or column.

3. Url-variables will update their values, even if no file is download.

 

There are work-arounds, but they are limiting.

 

The Powershell script :

 

#PARAMETERS
#  $pv : Name of Ketarin variable that will display previous version.
#  $cv: Name of the Ketarin variable that will display current version.
#
#ASSUMPTIONS
#  1.That the job has a urlVariable dedicated to displaying the previous version number.
#  1.That the job has a urlVariable dedicated to displaying the current version number.
#  2.Script will be run AFTER the download is complete.
#  3.That $pv is a Textual Content variable.
#
#NOTES
#  1.The script uses the "postData" property of $pv.
#  2.Job will begin showing previous version on the second update.
#  3.There are a series of corner cases not accounted for.
#  3.1.For example, when an update occurs, without file download
#  4. The script is independant of file names, 


# VARIABLES
#
# Parameters
$pv = "previous"
$cv = "version"
#
# Previous Variable Property Values
$pvPostData = $app.variables.$pv.postData
$pvContent = $app.variables.$pv.TextualContent

# Get the type of url-variable used for the current version
$cvType = $app.variables.$cv.VariableType
# Based on type(3 possible), determine the property name that holds the value 
$pnm = if($cvType -eq "Textual"){"TextualContent"}Else{"CachedContent"}
# Use it to get the current value(from this cycle)
$cvContent = $app.variables.$cv.$pnm

 


# MAIN
#
# 1. Copy postData(stored last cycle) to content of previous version variable
$app.variables.$pv.TextualContent = $pvPostData
# 2. Copy content of current version variable(stored this cycle) to postData property of $pv
$app.variables.$pv.postData = $cvContent

Share this post


Link to post
Share on other sites

thanks for trying,

I tried to paste your code in the Commands box of the 7-Zip profile and setting it to "Powershell script" but I must be missing something (maybe in your assumptions). I thought it would've been much easier to implemenet such a functionality in Ketarin.

I guess we'll have to wait for an official inclusion of such a function.

thanks for your effort though! 

Share this post


Link to post
Share on other sites

thanks for trying,

I tried to paste your code in the Commands box of the 7-Zip profile and setting it to "Powershell script" but I must be missing something (maybe in your assumptions). I thought it would've been much easier to implemenet such a functionality in Ketarin.

I guess we'll have to wait for an official inclusion of such a function.

thanks for your effort though! 

Installing the script :

1. Paste into "[...] after downloading" command input and set to "Powershell script"

2. Within the job create two url variables:

A. One which will automatically get the current version(eg. A regular expression variable)

B. And another, a "Textual content" variable, which will be managed by the script.

3. Within the script set the parameters : $cv to the name you used for (A) and $pv to (B).

    Set the variables under the "Paramters" comment, only. Not every where you see $cv/$pv.

4. Create custom columns which reference the names of (A) and (B)

5. Make those columns visible in the job list(usually this is automatic).

 

Note : After installation, the previous($pv) variable and column will not be filled until the second update of the job/app. Thus it may seem like it is not working. Every update, after the second, will be visible.

Share this post


Link to post
Share on other sites

I tried to run the script but I'm getting a System.Management.Automation not found error.

I installed the Windows Management Framework 3.0 (Windows6.1-KB2506143-x64.msu) as suggested here: http://blogs.msmvps.com/vstsblog/2014/02/14/build-fails-with-missing-file-system-management-automation-dll/

but I still get this error once the download is complete (see attachment).

Are there any prerequisites to use your Powershell code?

 

 

post-10055-0-18917600-1468010888_thumb.png

Share this post


Link to post
Share on other sites

I tried to run the script but I'm getting a System.Management.Automation not found error.

I installed the Windows Management Framework 3.0 (Windows6.1-KB2506143-x64.msu) as suggested here: http://blogs.msmvps.com/vstsblog/2014/02/14/build-fails-with-missing-file-system-management-automation-dll/

but I still get this error once the download is complete (see attachment).

Are there any prerequisites to use your Powershell code?

Install Powershell 5 : https://www.microsoft.com/en-us/download/details.aspx?id=50395

Using (1.8.6 b2/1.8.6.600)

 

At least that's how I managed to resolve it after recently re-installing windows 8.1 on my dev computer.

Share this post


Link to post
Share on other sites

now it's working thanks!

the only problem now is the coexistence with other post-download commands such as extraction, eg.

 

"C:\Program Files\WinRAR\winrar.exe" x -ac -ibck -o+ "{file}" "D:\Soft\Audio & Video\Audio Editing\TagScanner\"

 

since there is space for only one command, either I have one or I have the other right?

Share this post


Link to post
Share on other sites

I've solved this by pasting your script in the global command after updating an applicationOnce and for all! So now I can manage individual scripts for downloaded applications (like extraction!)

 

thank you for your precious help!

Share this post


Link to post
Share on other sites

Hello everybody,

do you think it is possible to optimize the script so that you don't have to update (which means force redownload) each item 2 or 3 times in a row?

or it's a technical limitation that cannot be solved at the moment?

Also: is it possible to download files from links protected with authentication (login and password)?

thank you 

Share this post


Link to post
Share on other sites

There are several examples on the forum of downloading with post authentication or via authentication proxy.

I'm not seeing the behavior you describe where, after the first cycle of collecting the old version, it would require 2 or more cycles to correctly assign values.

Share this post


Link to post
Share on other sites

hmm.. it happens everytime to me, just like Ambimind said in his topic. Before I get to see the updated value, I have to force redownload the updated version two times for evey item that has a new update before the updated values are correctly shown.

On 7/8/2016 at 12:34 AM, Ambimind said:

Installing the script :

 

1. Paste into "[...] after downloading" command input and set to "Powershell script"

2. Within the job create two url variables:

A. One which will automatically get the current version(eg. A regular expression variable)

B. And another, a "Textual content" variable, which will be managed by the script.

3. Within the script set the parameters : $cv to the name you used for (A) and $pv to (B).

    Set the variables under the "Paramters" comment, only. Not every where you see $cv/$pv.

4. Create custom columns which reference the names of (A) and (B)

5. Make those columns visible in the job list(usually this is automatic).

 

Note : After installation, the previous($pv) variable and column will not be filled until the second update of the job/app. Thus it may seem like it is not working. Every update, after the second, will be visible.

 

Share this post


Link to post
Share on other sites
On 10/9/2018 at 7:01 AM, shawn said:

There are several examples on the forum of downloading with post authentication or via authentication proxy.

Sorry, I couldn't find examples of server authentication in the forum...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.