Jump to content
Ketarin forum

Ketarin 1.8.3 beta


floele
 Share

Recommended Posts

Alright, please let me know when you tried it. I'm a bit unsure about handling the PS output...info, warning and error items are sent to the log window, while errors during execution (should probably be syntax errors and similar issues) are handled as exception / error message.

Link to comment
Share on other sites

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 weeks later...

Well, I can confirm that at least creating shortcuts works via powershell method...

$WShell = New-Object -ComObject WScript.Shell
$ShortCut = $WShell.CreateShortcut("$env:AppData\Microsoft\Internet Explorer\Quick Launch\$($App.Name).lnk")
$Shortcut.TargetPath = "$env:SystemDrive\$($App.Name)\$($App.Name).exe"
$Shortcut.WorkingDirectory = "$env:SystemDrive\$($App.Name)"
$Shortcut.IconLocation = "imageres.dll,-65"
$Shortcut.Save()

So I could drop usage of nircmd.exe (actually that was the only reason to use it for me) for this...

Copy-Item
Remove-Item 

Works too...

 

Unfortunately I must say, I have had no time to test anything else, as my personal life kicked in a bit... :(

 

EDIT: Forgot to add that:

Expand-Archive -Path $App.CurrentLocation -Destination "C:\Temp"

Works too (Extracts the Zip file, requires Powershell 5.x), and "Expand-Item" throws error messagebox (As it should), as I managed to enter incorrect cmdlet name... :P

 

Also, who is interested variable $App psobjects, which you can use in scripts, I dumped them:

 

 

 

$App | Get-Member
13.02.2016 19:43.47: PowerShell: void Delete()
13.02.2016 19:43.47: PowerShell: bool Equals(System.Object obj)
13.02.2016 19:43.47: PowerShell: void ExecutePostUpdateCommands()
13.02.2016 19:43.47: PowerShell: int GetHashCode()
13.02.2016 19:43.47: PowerShell: string GetTargetFile(System.Net.WebResponse netResponse, string alternateFileName)
13.02.2016 19:43.47: PowerShell: type GetType()
13.02.2016 19:43.47: PowerShell: string GetXml()
13.02.2016 19:43.47: PowerShell: string GetXmlWithoutGlobalVariables()
13.02.2016 19:43.47: PowerShell: void Hydrate(System.Data.IDataReader reader)
13.02.2016 19:43.47: PowerShell: void Install(System.ComponentModel.BackgroundWorker bgwSetup)
13.02.2016 19:43.47: PowerShell: bool MatchesSearchCriteria(string[] subjects, System.Collections.Generic.Dictionary[string,string] customColumns)
13.02.2016 19:43.47: PowerShell: bool RequiresDownload(System.Net.WebResponse netResponse, string targetFile)
13.02.2016 19:43.47: PowerShell: void Save()
13.02.2016 19:43.47: PowerShell: string ToString()
13.02.2016 19:43.47: PowerShell: bool UpdateFromXml(string[] xmlValues)
13.02.2016 19:43.47: PowerShell: bool AvoidDownloadBeta {get;}
13.02.2016 19:43.47: PowerShell: bool CanBeShared {get;set;}
13.02.2016 19:43.47: PowerShell: string Category {get;set;}
13.02.2016 19:43.47: PowerShell: bool CheckForUpdatesOnly {get;set;}
13.02.2016 19:43.47: PowerShell: string CurrentLocation {get;}
13.02.2016 19:43.47: PowerShell: bool DeletePreviousFile {get;set;}
13.02.2016 19:43.47: PowerShell: Ketarin.ApplicationJob+DownloadBetaType DownloadBeta {get;set;}
13.02.2016 19:43.47: PowerShell: System.Nullable[datetime] DownloadDate {get;set;}
13.02.2016 19:43.47: PowerShell: Ketarin.ApplicationJob+SourceType DownloadSourceType {get;set;}
13.02.2016 19:43.47: PowerShell: bool Enabled {get;set;}
13.02.2016 19:43.47: PowerShell: bool ExclusiveDownload {get;set;}
13.02.2016 19:43.47: PowerShell: string ExecuteCommand {get;set;}
13.02.2016 19:43.47: PowerShell: Ketarin.ScriptType ExecuteCommandType {get;set;}
13.02.2016 19:43.47: PowerShell: string ExecutePreCommand {get;set;}
13.02.2016 19:43.47: PowerShell: Ketarin.ScriptType ExecutePreCommandType {get;set;}
13.02.2016 19:43.47: PowerShell: string ExpandedWebsiteUrl {get;}
13.02.2016 19:43.47: PowerShell: bool FileExists {get;}
13.02.2016 19:43.47: PowerShell: string FileHippoId {get;set;}
13.02.2016 19:43.47: PowerShell: string FileHippoVersion {get;set;}
13.02.2016 19:43.47: PowerShell: string FixedDownloadUrl {get;set;}
13.02.2016 19:43.47: PowerShell: guid Guid {get;set;}
13.02.2016 19:43.47: PowerShell: Ketarin.HashType HashType {get;set;}
13.02.2016 19:43.47: PowerShell: string HashVariable {get;set;}
13.02.2016 19:43.47: PowerShell: string HttpReferer {get;set;}
13.02.2016 19:43.47: PowerShell: bool IgnoreFileInformation {get;set;}
13.02.2016 19:43.47: PowerShell: System.Nullable[datetime] LastFileDate {get;set;}
13.02.2016 19:43.47: PowerShell: long LastFileSize {get;set;}
13.02.2016 19:43.47: PowerShell: System.Nullable[datetime] LastUpdated {get;set;}
13.02.2016 19:43.47: PowerShell: string Name {get;set;}
13.02.2016 19:43.47: PowerShell: string PreviousLocation {get;set;}
13.02.2016 19:43.47: PowerShell: System.Collections.Generic.List[Ketarin.SetupInstruction] SetupInstructions {get;set;}
13.02.2016 19:43.47: PowerShell: bool ShareApplication {get;set;}
13.02.2016 19:43.47: PowerShell: string SourceTemplate {get;set;}
13.02.2016 19:43.47: PowerShell: System.Xml.XmlCDataSection SourceTemplateCdata {get;set;}
13.02.2016 19:43.48: PowerShell: bool TargetIsFolder {get;}
13.02.2016 19:43.48: PowerShell: string TargetPath {get;set;}
13.02.2016 19:43.48: PowerShell: string UserAgent {get;set;}
13.02.2016 19:43.48: PowerShell: string UserNotes {get;set;}
13.02.2016 19:43.48: PowerShell: string VariableChangeIndicator {get;set;}
13.02.2016 19:43.48: PowerShell: Ketarin.ApplicationJob+UrlVariableCollection Variables {get;set;}
13.02.2016 19:43.48: PowerShell: string WebsiteUrl {get;set;}

 

 

 

Only thing I`m missing, is tab completion in script window, but that is something which I`m just used to so it is not an actual problem...

Script window is not an console, so it behaves like it is designed to behave. :)

Link to comment
Share on other sites

You can use the "Variables" collection for user defined variables. The global variables are not accessible yet, but I suppose I could make it happen.

 

Actually it would be great, if you could implement global variables access too, like Batch scripts have them.

As I have quite a few Install/destination paths defined as global variables.

 

EDIT: OK, already Figured out how to get custom variable value:

$app.variables.item("%VARIABLE_NAME%").cachedcontent
Link to comment
Share on other sites

Finally got around to test the PowerShell integration a bit. Here are my observations so far.

 

Working:

  • Common commands (copying, creating directories, etc.) do work.
  • Dot-sourcing of external scripts works, too! (Great for integrating custom functions.)
  • 'Write-Error -ErrorAction Stop' does abort a script with the appropriate status message.
Issues/suggestions:

  • Having 'Write-Error' anywhere in the script suppresses all output (Write-Warning & Write-Host) to the log file.
  • Warning messages are printed before all the info messages of 'Write-Host', not in order of appearance.


  • Script:
    Write-Host '1. Message 1.'
    Write-Warning '2. Warning 1.'
    Write-Host '3. Message 2.'
    Write-Warning '4. Warning 2.'

    Output:
    > 2. Warning 1.
    > 4. Warning 2.
    > 1. Message 1.
    > 3. Message 2.


  • Could the 'Installing Applications' progress dialog maybe recognize warnings and display a yellow icon and the status 'Installation successful (with warnings)'?
Link to comment
Share on other sites

Beta2 seems to have a Filehippo bug again (Beta1 is fine). My Filehippo apps keep downloading at every update because of MD5 mismatch.

 

I can confirm that the Filehippo bug is back with the latest Beta 2 and 3. Since most of my files are from FileHippo, it takes forever to redownload them all, even though most don't have any new updates. The log just says that the MD5 doesn't match, so it downloads it. No errors. Do I have to re-create every single entry in my database to possibly fix this? That would be a pain but I guess I could try it on a few of them to test...

Link to comment
Share on other sites

When testing with 7-zip (x64), here's the log after I recreated the application from scratch, asked it to download the first time, then asked it to check for updates (but not download) a second time:

2/17/2016 10:22:04 AM: Update started with 1 application(s)
2/17/2016 10:22:05 AM: 7-zip (x64): Using referer: http://filehippo.com/download_7-zip_64/
2/17/2016 10:22:05 AM: 7-zip (x64): Server source file: /download/file/186d81f030ce70c56332867fc9cc524534020a53f3f92b26d025dcc25c7209c7
2/17/2016 10:22:05 AM: 7-zip (x64): Determined target file name: C:\Users\Randy\Documents\USBkey\Programs_Tools\Ketarin\..\Common\7z-x64.msi
2/17/2016 10:22:05 AM: 7-zip (x64): Checking if update is required...
2/17/2016 10:22:05 AM: 7-zip (x64): Update required, file modified dates do not match
2/17/2016 10:22:15 AM: Update finished
2/17/2016 10:22:21 AM: Update started with 1 application(s)
2/17/2016 10:22:21 AM: 7-zip (x64): Using referer: http://filehippo.com/download_7-zip_64/
2/17/2016 10:22:21 AM: 7-zip (x64): Server source file: /download/file/830f8979aaade4eb4110a611ccd34e77c800620eb184f242a73af6140d99a293
2/17/2016 10:22:21 AM: 7-zip (x64): Determined target file name: C:\Users\Randy\Documents\USBkey\Programs_Tools\Ketarin\..\Common\7z-x64.msi
2/17/2016 10:22:21 AM: 7-zip (x64): Checking if update is required...
2/17/2016 10:22:22 AM: 7-zip (x64): Update required, MD5 does not match
2/17/2016 10:22:22 AM: 7-zip (x64): Skipped downloading updates
2/17/2016 10:22:22 AM: Update finished

Any further checks or downloads always state MD5 mismatch. I was using this about once a week to update certain files, but I can't do that if it's going to re-download many GBs of data for no reason. I hope there's a solution and I'm willing to do whatever I can to test.  :-)

 

Thanks.

Link to comment
Share on other sites

As already mentioned, variables of the type 'Textual Content' can be accessed by '$app.Variables.{VariableName}.TextualContent' and variables of type 'Content from URL (Regular Expression)' via '$app.Variables.{VariableName}.CachedContent'.

 

But I cannot get the value of a 'Content from URL (start/end)' variable. In this case '$app.Variables.{VariableName}.CachedContent' is empty.

Link to comment
Share on other sites

 

But I cannot get the value of a 'Content from URL (start/end)' variable. In this case '$app.Variables.{VariableName}.CachedContent' is empty.

I think it is by design, as those results are not cached into Jobs.db as well, so it is actually empty as variable retrieves them from jobs.db AFAIK. 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Find a minor bug/feature, when you are saving powershell script as snippet and try to reuse that snippet it won`t work.
 

As it keeps default "Write-Host $App.Name" statement in that window and appends it to last command of the the snippet, instead of just replacing it with snippet.

So each time you use a snippet, you have to delete that manually...

 

If intenion is to keep it (by design), it should be either first separate line, so snippet code would be appended afterwards beginning of the second line to it or it should be appended as separate line into end. Right now it appends it to the last command of snipped, which makes snippet code to fail unless you delete it before adding snippet or after adding snippet.

Link to comment
Share on other sites

Hm, I actually think the snippet should be inserted at the cursor position. A snippet could be anything, doesn't need to be some lines of code, could also be function arguments. Forcing a line break then would not be helpful.

Link to comment
Share on other sites

Hm, I actually think the snippet should be inserted at the cursor position. A snippet could be anything, doesn't need to be some lines of code, could also be function arguments. Forcing a line break then would not be helpful.

 

Hm, indeed...

Link to comment
Share on other sites

  • 4 weeks later...

Yes, you cannot rely on this field being filled anyway. If you need to get the correct value you should resolve the variable (which may need web requests though).

 

How do I go about resolving the variable? It's a custom regex variable. I think this is basically my question.

 

[EDIT]

 

Nevermind, figured it out: $app.variables.ReplaceAllInString("{VAR}")

Link to comment
Share on other sites

  • 3 weeks later...

Wondering why this does not work in Ketarin, while similar operation works in everywhere else:

if ((Get-WmiObject -Class CIM_VideoController).Caption -like "Intel*") {
    $hwa_lav_hwaccel = 2
} else {
    $hwa_lav_hwaccel = 4
}

Get-Content (Join-Path $($GlobalVars.item('settings').cachedcontent)\"K-Lite Codec Pack"\klcp_standard_unattended.ini) | ForEach-Object {
    $_ -replace "^hwa_lav_hwaccel\s*=.*","hwa_lav_hwaccel=$hwa_lav_hwaccel"
} | Set-Content (Join-Path $($GlobalVars.item('settings').cachedcontent)\"K-Lite Codec Pack"\klcp_standard_unattended.ini)

Capture.png

 

File itself is plain txt file and is not open in everywhere else.

Reading it seems to work, but Set-Content aka saving part fails, unless I give different filename to it.

 

Seems like Ketarin leaves file open after reading contents of it, so saving to it becomes impossible.

Link to comment
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
 Share


×
×
  • 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.