Jump to content
Ketarin forum

Ambimind

Members
  • Posts

    67
  • Joined

  • Last visited

Posts posted by Ambimind

  1. Trying to get the Windows Setup package from this page:  http://www.freefilesync.org/download.php

     

     

    When I download the file with web browser, this is what I see:

     

    GET http://www.freefilesync.org/download/FreeFileSync_8.10_Windows_Setup.exe

    [HTTP/1.1 302 Moved Temporarily 187ms]

    GET http://www.mediafire.com/file/bw49xxy2n4i9fhr/FreeFileSync_8.10_Windows_Setup.exe

    [HTTP/1.1 302 Found 250ms]

    GET http://download1259.mediafire.com/5qcrsrmlm45g/bw49xxy2n4i9fhr/FreeFileSync_8.10_Windows_Setup.exe

    [HTTP/1.1 200 OK 15079ms]

     

     

    Is there a way to capture the moved URL with Ketarin to download it?

     

    I've attached a working job file which you can import into Ketarin(1.8.7) : File > Import.

     

    You will notice that no special settings are required to get it working. I believe Ketarin can handle simple file redirects of this kind without issue; however problems do arise when one is redirected to a website which requires running of javascript to generate the url.

    Please note that you must change the download directory according to your setup.

     

    Edit : On the next day the job stopped working, I've made the required changes and re-uploaded.

    FreeFileSync.xml

  2. Beta 3 : Impressions after a week of use :

     

    The new features are extremely useful, but they should be used sparingly.

     

    Specifically the use of url-variables-as-scripts, in custom columns : This means each job has a variable which holds a script; this variable is referenced and run to produce the value of a custom column. The script being run, in my case, compares the creation date of each file and calculates the days since update :

    (New-TimeSpan (GI $app.CurrentLocation).LastWriteTime (Date)).Days

    Issues were myriad and some intermittent :

    1. 5-10s startup times(~100 jobs)
    2. crash on start
    3. crash during update cycle
    4. unresponsive/flickering interface during update cycle
    5. app update checks timing out("connection timeout": 30)
    6. much slower over-all update cycle("parallel downloads":6)

    I also had a global (pre-download) script running, which added this 'script-variable' to jobs automatically(another new feature):

    #### ADD DATE VARIABLE IF NOT EXISTING
    # Parameters
    $varnm = "SinceUpdate"
    $vartp = "Textual" #StartEnd #Textual #RegularExpression
    #
    # Derived access property
    $varcnt = if($vartp -eq "Textual"){"TextualContent"}Else{"CachedContent"}
    
    # If it doesn't exist, then create a new one
    if(-Not $app.variables.$varnm){
        ECHO "========== $varnm NOT FOUND =========="
        $newvar = New-Object -TypeName Ketarin.UrlVariable -ArgumentList $varnm,$app.variables
        $newvar.VariableType = $vartp  
        $app.variables.Add($varnm, $newvar)
        $app.Save() 
    }
    #Set newly created variable
    $app.variables.$varnm.$varcnt = '(New-TimeSpan (GI $app.CurrentLocation).LastWriteTime (Date)).Days'
    ####

    I've had no issues with multi-segment downloads(using 4 segments).

     

    I'm not classing these behaviors as 'bugs', just something to keep in mind when using these features.

  3. Creating accounts is actually disabled because of spam. I created a new account for you now (you should have received an e-mail).

    Thanks logged in.

    However both image uploads and external image embedding is disabled, as is page creation(not needed atm).

    I've added a section to the functions page, with bare links to the external image host.

  4. Would you like to put some of the examples you gave into the wiki?

    Not able to add to the wiki.

     

    Tried and failed:

    - logging in with forum details

    - creating mediawiki account, and using those details

     

    Login attempts result in : " There is no user by the name[...] "

  5. Working regex : (?<=v)\d+\.\d+\.\d+(-beta\.\d+)?

    Note : It should continue to work even after the beta, assuming they don't change versioning scheme.

     

    Ketarin will match the first instance only and then stop.

    Luckily, in most cases the latest version is the first to appear on a page, permitting a much simplified regex. 

  6. Karan, I hope you understand you only get one of these  B)
     
    Dashlane : 

    URL : hxxps://www.dashlane.com/directdownload?platform=win

    Works fine for me with Ketarin 1.8.6 b3

     
    Etcher:

    URL : hxxps://resin-production-downloads.s3.amazonaws.com/etcher/{version}/Etcher-win32-x64.exe

    version src : hxxps://github.com/resin-io/etcher/releases

     
    Gamesaver : 

    URL: hxxp://www.gamesave-manager.com/?s=download&a=dl

    referer: hxxp://www.gamesave-manager.com/?s=download

    User-agent : Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

    Works fine for me with Ketarin 1.8.6 b3

     
    MuzicBrainz Picard

    Looks like you may have discovered a bug - the date variables don't like ftp urls? 

    Remove the date variables and it will work. If not remove spaces form app name. 

    Since the file name from the server includes a version, you can just "Save in folder" - that is, without a filename specficiation.

     
    Unified Remote Server

    URL:hxxps://www.unifiedremote.com/download/windows

    Works fine for me with Ketarin 1.8.6 b3

     

    Edit : Replace "hxxp" with "http"

  7. Thanks for testing!

     

    Would you like to put some of the examples you gave into the wiki? I think it's more easy to find there. Having some screenshots like these in there would be a great addition.

    Sure. Not confident in my ability to do this, but I'll give it a shot this coming weekend.

  8. The issue isn't just with downloading new software though, it's with multiple queries. So if I have 3 softpedia updates queued, and it checks all three of them in succession and they don't require downloading, it won't trigger the pre/post download commands and you still get locked out.

    Ketarin 1.8.6 b3 introduced a feature which is exactly suited to this goal. 

    Please follow the visual instruction below : 

    Qg2XYUG.png

  9. Very useful updates, thank you kindly for your efforts floele.
     
    Beta 3 : Observations and Examples of the new features :
     
    Segmented downloading (enable in Settings -> Connection)
    Tested with 10MB, ~300MB and ~700MB files; segments set to 3.
    Integrity of files is maintained after download.
    Have confirmed 3 open sockets, consuming all available download speed.
     
    Made UrlVariable constructor public
    Works as advertised, thx. It's a little confusing that a variable name is required, both when creating the variable-object and adding it to the job.
     
    Function runpowershell / ps for executing variable content as power shell script and returning its result
    After testing as shown in examples below, I found no fault in the implementation.
     
    This feature brings several new possibilities to Ketarin :
    a. Derivation of variable value from a Powershell script, in the moment of use.(global,app or column variable)
    b. Execution of Powershell scripts before 'pre-download' scripts, during checks for updates
    c. Execution of Powershell scripts to determine the download url
    d. Execution of Powershell scripts before evaluation of custom-column-variables.
    NOTE : 
    - Global and app/url-varaibles containing Powershell scripts will not execute unless used.
    - Where one uses a variable, determines at what stage of the update cycle it is executed.
    - Custom-column-values will be calculated every update
    - Custom-column-values will be calculated every time Ketarin starts. Delays in startup time will occur if your are running a powershell script for many jobs.
     
    Example 1 : Shows the use of a url-variable as script, used within the download URL. Note that in this specific case, the script returns nothing. Its purpose is just to execute a script before all others, and to do this on every check for updates.
    Var : {a_script} Use : {a_script:ps}
     
    Example 2 : This example demonstrates a ketarin-global-variable as a script, used within the download path. In this case it references a system-global-variable. 
    Var : {COMPUTERNAME} Use : {COMPUTERNAME:ps}
     
     
    B07Dwom.png
     
    [21_August_2016] : Added usage note : "Custom-column-values will be calculated every time Ketarin starts. Delays in startup time will occur if your are running a powershell script for many jobs."
  10. As an example of the new feature, following the release of Ketarin 1.8.6 beta 3 / 1.8.6.700, please find below the working version of the prior mock-script : 

     

    #### ADD DATE VARIABLE IF NOT EXISTING
    # Parameters
    $varnm
    = "LastUpdate"
    $vartp = "Textual"   #StartEnd or #Textual or #RegularExpression
    #
    # Derived access property, ie. app.variables.$varnm.$varcnt
    $varcnt = if($vartp -eq "Textual"){"TextualContent"}Else{"CachedContent"}

    # If it doesn't exist, then create a new one
    if(-Not $app.variables.$varnm){
        #
        ECHO "========== $varnm NOT FOUND, ADDING IT =========="
        #
        # Add var to job/app
        $newvar = New-Object -TypeName Ketarin.UrlVariable -ArgumentList $varnm,$app.variables
        $newvar.VariableType = $vartp 
        $app.variables.Add($varnm, $newvar)
        $app.Save()
    }

     

    #Set it to the current date, short format(should be sortable)
    $app.variables.$varnm.$varcnt = Get-Date -UFormat %d-%m-%y

    #
    ####

     

    Usage Notes :

     

    Step 1 : Add a custom volumn. The value, variable name, corresponds to $varnm in the script

    Step 2 : Input the script to run for every job/app, after download is complete

     

    kzUIBNG.png

  11. Hello,

    I've been trying to set up Ketarin to download IntelliJ but I can't seem to get it to work.

     

    It can be downloaded from the page:

    https://www.jetbrains.com/idea/download/#section=windows

     

    and the download link is of the form:

    https://download-cf.jetbrains.com/idea/ideaIC-2016.2.1.exe

     

    The version number is shown on the page but I'm not able to extract it from the source. Must be some sort of script that gets it. Not sure how I can get it, though.

     

    Also,

    It can be downloaded using the link https://www.jetbrains.com/idea/download/download-thanks.html&platform=windows&code=IIC

    but when I use this url, Ketarin returns a error saying the file isn't of binary format. 

     

    Any help would be appreciated. Thanks!

    As a general rule, when a website uses JS to populate html dynamically, it may make an XHR request. If so we can use the data, usually simple JSON text, to get what we need.

     

    In this case, the XHR request URL is : https://data.services.jetbrains.com/products/releases?code=IIU%2CIIC&latest=true&type=release

    Note : If they decide to change the API, it is possible that they make use of cookies and post data not encoded in the url. In this case you'll need to check the headers.

     

    I've included a working job. Check the "URL" variable in case they modify their versioning scheme.

    IntelliJ_IC.xml

  12. Is this profile working correctly for you? Because it isn't for me. I get a 404 not found error. 

    It's a silly regex issue, which raised its head when they moved the build number above 2 digits. I've edited the original post with the corrected job.

  13. 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.

  14. OK, I will make the following constructor public:

     

    public UrlVariable(string name, ApplicationJob.UrlVariableCollection collection)

     

    Second argument requires you to pass in the Variables property of an application. Also, you have to call the Save() method on the application after doing that, otherwise the variable will be lost.

    Thank you.

    What will be the type of urlVariable created(ie. Textual..)?

  15. Thanks for the feedback floele.

     

    Use case :

     

    I want to create a custom column which records the last time an application was updated.

    The purpose is to detect abandonware and website structure changes(and thus silently failing regex matches).

     

    With more then 100 items in my database, I would need to manually create an - eg. "Updated" variable - for each job, and for all those new.

    I'd prefer to have a global post-download Powershell script, which checks for the job-specific "Updated" variable, and if not found create and update it.

     

    Example script :

     

    # Parameters

    $varnm = "Updated"
    $vartp = "Textual"
    #
    # Derived access property
    $varcnt = if($vartp -eq "Textual"){"TextualContent"}Else{"CachedContent"}

    # Check if variable exists in "variables" object

    $exists = $app.variables | Get-Member -name $varnm
    #
    # If it doesn't exist, then create a new one, also set date
    if(-Not $exists){
         $newvar = New-Object -TypeName Ketarin.UrlVariable -ArgumentList $vartp
         $app.variables.Add($varnm, $newvar)
         #
         # Set it to the current date, short
         $app.variables.$varnm.$varcnt = Get-Date -UFormat %d-%m-%y
    }

    # END 

  16. First of all, please don't touch the database, thanks! ;)

     

    Next, I think I can easily implement a solution for such cases. I will provide a function "runpowershell" (and "ps" as shortcut) with the next version, that simply runs a PowerShell script.

     

    So in other words: Create a new variable with the textual content (or global var) "$env:computername".

    Then use the variable like this: {test:ps}

    This would certainly be useful, thx.

    Some questions about the solution :

    a. I presume the script would run before the pre/post-update scripts?

    b. If a multi-line script, is the value of the url-variable the last printed Powershell variable?

    c. Does the url-variable-script have access to its state, from the previous run; does it have access to other variables/global vars?

  17. Any chance this might have been implemented in a later Ketarin build?  If it hasn't, I'd like to submit it as a feature request.

     

    I want to do something along the same lines as jeff9315, but in my case I would like to manipulate an application level variable that is dynamically assigned using "before updating an application" to be used both in the download path and in the "after updating an application" script.  I'm currently doing this with a static variable, but could be automated if done dynamically.

     

    PS: I'd happily use shawn's suggestion; however if I understood it correctly updating the variable using sqlite is done before launching Ketarin and I'm looking for something that changes after Ketarin has already been opened.

     

    Through Ketarins recently added ability to run Powershell scripts, it is possible to modify global and application variables during the pre/post update commands:

    # Local Set
    $app.variables.appv.TextualContent = "My new content"
    #
    # Local Get
    $app.variables.appv.TextualContent
    #
    # Note: "appv" is created manually before local set/get. At creation, its type is set to "Textual content".
    
    # Global Set
    $globalvars.globv.CachedContent = "My new content"
    #
    # Global Get
    $globalvars.globv.CachedContent
    #
    # Note: "globv" is created manually before global set/get.
    

    Regarding their use :

    In post-download scripts : Changes made in the pre-download script will be available.

    In download paths : Changes made - in the current update cycle - in the pre-download script, will not be available. That is, the stored values from the previous download cycle will be used. 

     

    I would avoid modifying the database directly; multiple actors, unaware of each other, modifying common state, at indeterminate times -- is a recipe for headaches.

  18. Wondering if this is possible?

     

    What I tried :

     

    The "$app.variables" object has the following method :

    void Add(string key, Ketarin.UrlVariable value)

     

    This tells me I need to create an instance of "Ketarin.UrlVariable":

    I try this : New-Object -TypeName Ketarin.UrlVariable

    Error message results : "A constructor was not found .."

     

    So I thought maybe the constructor requires some parameters:

    I tried to find them : ([Type]"Ketarin.UrlVariable").GetConstructors() | ForEach {$_.GetParameters()} | Select *

    No output in log.

     

    So does this mean we don't have access to the "Ketarin" namespace?

     

    Thx

  19. 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.

  20. 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

  21. Thank you for sharing. This is almost exactly what I would like to implement for several of my apps. :)

    Glad to know it.

     

    Since you're already performing a GCI on there and collecting valuable input for the base name, you should be able to store everything in one folder with something like this:

    $fsorted = Get-ChildItem -File -Name $app.Name"_*."$fext | Sort-Object -Property LastWriteTime -descending

    That should (assuming you pattern your downloaded file names similarly) correctly select only matching files for filtering, then removal, thus eliminating the need to use a unique folder per application.

    Thanks for the tip. To my surprise this actually works, despite the fact that "-Name" returns an array of filenames, rather then a collection of "FileInfo" objects.

     

    As you suggest, the script implementation becomes dependent on file name form; I wanted to avoid this manual alignment and re-alignment when change occurs. Also in some of my jobs the supporting files have similar names and extensions to the installers. So I took the blanket approach.

×
×
  • Create New...

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.