Skip to content

Instantly share code, notes, and snippets.

@Nillth
Created November 22, 2021 22:57
Show Gist options
  • Save Nillth/dc33fa35e91217d957aa14ad68bc36bd to your computer and use it in GitHub Desktop.
Save Nillth/dc33fa35e91217d957aa14ad68bc36bd to your computer and use it in GitHub Desktop.
Export QlikView Load Scripts
<#
.NOTES
===========================================================================
Created on: 2021-11-23 9:36 AM
Created by: Marc Collins
Email: [email protected]
Organization: Qlik
Filename: Export_QV_LoadScript.ps1
===========================================================================
#>
#Start QlikView Desktop
$QV = New-Object -ComObject QlikTech.Qlikview
#Wait for QlikView Desktop to fully launch
$QV.WaitForIdle() | Out-Null
$Global:QVVersion = $QV.QvVersion()
$QVPID = $QV.GetProcessId()
$QV.DisableDialogs($true)
#Specify the Folder to scan for QV Documents
$ScanFolder = "C:\ProgramData\QlikTech\SourceDocuments"
#Get all of the QV documents in folder
$QVWFiles = Get-ChildItem -Recurse -Path $ScanFolder -Filter "*.qvw"
foreach ($QVWFile in $QVWFiles)
{
#Open the Document without Data
$QVDoc = $QV.OpenDocEx($QVWFile.FullName, 0, $false, $null, $null, $null, $true, $true)
#Get the properties so we can access the script
$QVDocProperties = $QVDoc.GetProperties()
###### DO Something with this.......
$ScriptFile = "$([System.IO.Path]::GetTempPath())$($QVWFile.Name).txt"
$QVDocProperties.Script | Out-file -FilePath $ScriptFile -Encoding utf8
notepad.exe $ScriptFile
#Close the Document
$QVDoc.CloseDoc()
}
#Quit QlikView Desktop
$QV.Quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment