Jump to content
Ketarin forum


  • Content count

  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  1. thanks, I was converting some batch/sqlite scripts to PowerShell. one problem I hit was, that I couldn't create new variable. That thread you pointed out is describing newly added constructor and how to use it. It's working fine, I don't have problem there. This is another issue, which I already had while using batch/sqlite. It seems like that when you add a Custom Column with Textual variable, lines under the Custom Column are showing CachedContent, regardless of type of variable used being Textual (StartEnd / Textual / RegularExpression) When you set Textual variable in Ketarin, only TextualContent is updated and without a workaround, where I am copying values from TextualContent to CachedContent, the Custom Column shows nothing. Of course the workaround is not perfect, but satisfactory for my case. My question being, is this happening only to me? Or is this a bug/program limitation. I think this problem is related. Thirdly, I don't see a way to update the view. When I change the variable, old value is still showing under Custom Column. I can open/close Settings and it will update, but I would expect there should be PS way to refresh the view.
  2. this is great, can we copy posts like this to wiki? Google didn't offer me this as a result, I went down the same path, but giving up sooner, when `$newVar = New-Object -TypeName Ketarin.UrlVariable` did Error. Ended up using .Clone, which was working, but only when app has at least one variable. Then I found this post and used it in this function: # Changes variable value: $app.variables.<var_name>, creates new if it doesn't exists # usage: changeVar "my_var_name" "value" function changeVar { param( [String]$Name, [String]$Value, [String]$Type = "Textual" #StartEnd or #Textual or #RegularExpression ) # Derived access property, ie. app.variables.$varnm.$varcnt $Prop = if ($Type -eq "Textual"){"TextualContent"}Else{"CachedContent"} if (!$app.variables.$Name) { # create new variable $newVar = New-Object -TypeName Ketarin.UrlVariable -ArgumentList $Name,$app.variables $newVar.VariableType = $Type $newVar.$Prop = $Value $app.variables.Add($Name, $newVar) $oldTC = $null } else { # changing existing value $oldTC = $app.variables.$Name.TextualContent $oldCC = $app.variables.$Name.CachedContent $app.variables.$Name.$Prop = $Value } # workaround 1 - Copy value to CachedContent property, # so it will show under Column in main UI if ($Type -eq "Textual") {$app.variables.$Name.CachedContent = $Value} # workaround 2 - Clear the TextualContent property, # I needed this once, but it was probably because of a broken jobs.db. # No value was showing under Column, if TextualContent wasn't empty #$app.variables.$Name.TextualContent = $null $app.Save() # --- Log function shrt ($s) { # shorten if too long $MAX_LENGTH = 30 if ($s.length -gt $MAX_LENGTH) {return $s.Substring(0,$MAX_LENGTH-3) + '...' } else {return $s} } if ($oldTC -eq $null) { Write-Host "* Created variable: $Name, of type [$Type]," } else { Write-Host "* Changed variable: $Name, of type [$Type]," Write-Host (" from: " + (shrt $oldTC) + " | " + (shrt $oldCC)) } Write-Host (" to: " + (shrt $app.variables.$Name.TextualContent) + " | " + (shrt $app.variables.$Name.CachedContent)) Write-Host " (showing: TextualContent | CachedContent)" } <# To dot-source file, with this function in Ketarin script: # avoid using absolute path, get Ketarin working folder $pathInclude = Join-Path $app.variables.ReplaceAllInString("{startuppath}") "Include" . "$pathInclude\Variables.ps1" #> to add date, as in Ambimind post, use: $date = Get-Date -UFormat %d-%m-%y changeVar "LastUpdate" $date # or: changeVar "LastUpdate" (Get-Date -UFormat %d-%m-%y)
  3. papo

    New column in interface

    Isn't this why @rainroom can't see the value?
  4. How the Custom column should work with Textual variable? I used to be able to see value of a Textual variable under Custom Column added by a script, but only when I added the value also to CachedContent property. I was using sqlite for this. The value updated only after re-start, but it was working ok otherwise. Recently the whole Column showing my custom variable: "Current Version" remained blank and I thought this was broken by an update, but now I tried various old versions and the value is still not shown. I found an old jobs.db and the previous functionality returned, but the curious thing is, with the recent jobs.db, which wasn't showing my "Current Version", if I blank the TextualContent and keep only CachedContent, it will show it under the Column. I am doing this using PS: $app.variables.$Name.TextualContent = $null # "" works too I become quite certain that either I am doing something wrong, or this feature doesn't work for Textual variables. CachedContent is shown in Column, but TextualContent in UI > App > Edit > Variables > Textual content Shouldn't TextualContent be shown under Column for Textual variable? Could they maybe be interlocked for Textual variable type, to keep existing scripts functional?

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.