| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| ManageMoveSizeCopyClone.zip | 2014-05-09 | 8.6 kB | |
| Readme.txt | 2014-05-09 | 5.6 kB | |
| Totals: 2 Items | 14.2 kB | 0 |
Manage Move/Size/Copy/Clone in QlikView Documents
Author: Bill Chatfield <bill_chatfield@yahoo.com>
GENERAL DESCRIPTION
This is software to manage the ability to modify components in QlikView
QVW documents. After you are done with development of a QVW document,
you want to give it to your users. But you don't want them to change the
size or positioning of the charts and graphs. To lock down the document
you would have to bring up the Properties for each component to turn of
Move/Size and Copy/Clone. Then when you, the developer or designer,
want to fix problems with the document or add features, you have to go
back to the Properties of each of the components and turn on Move/Size
and Copy/Clone.
The scripts included in this package allow you to automatically turn
on and off Move/Size and Copy/Clone for all the components in a group
of documents that you select via a standard file selection dialog.
FILE DESCRIPTIONS
DisableMoveSizeCopyClone.bat
This batch file simply invokes ManageMoveSizeCopyClone.js with the
command line argument "disable" to disable Move/Size and Copy/Clone
in documents that the user will select.
The batch file uses the construct %~dp0 which is an automatically
populated variable containing the drive and path of the batch
file itself. The "d" specifies the drive. The "p" specifies the
path. The "0" specifies argument number 0, which specifies the
batch file itself. So, %~dp0 is the drive and path of the batch
file. This allows the batch file to find the
ManageMoveSizeCopyClone.js which exists in same directory as the
batch file. You can see the documentation for this feature in the
Windows Command Propmpt documentation for the "call" command
by typing: call /?
EnableMoveSizeCopyClone.bat
This batch file simply invokes ManageMoveSizeCopyClone.js with the
command line argument "enable" to enable Move/Size and Copy/Clone
in documents that the user will select.
ManageMoveSizeCopyClone.js
The main script which does the work to enable or disable Move/Size
and Copy/Clone in selected documents.
This script is written in Microsoft's JScript language of Windows
Script Host. This technology already exists on every Windows
machine. To run a JScript file, all you have to do is double-click
it.
This script uses Windows Script Host's ability to access ActiveX
(COM) obejcts to access the ActiveX components exposed by QlikView.
It opens QlikView documents, updates the Move/Size and Copy/Clone
properties of every component in the documents and then closes
the documents.
It runs the PowerShell script QvwFileSelector.ps1 to allow the
user to select QVW files.
QvwFileSelector.ps1
This script only implements the file selection functionality. It
is implemented as a PowerShell script because there is no dependable
method of displaying a file selection dialog in a Windows Script
Host script. There are some COM components one can take advantage
of to do this, but they aren't consistently available across all
versions of Windows.
So, I have used PowerShell because it has access to .NET libraries
which can display a standard file selection dialog across all
versions of Windows.
Now, I could have written everything in PowerShell as it can
access the ActiveX (COM) objects exposed by QlikView. And in fact
I have done that. But, I am not happy with the results. PowerShell
may be powerful, but as a language, it has drawbacks. I want to
write code that other people can read and understand. In terms of
readibility, PowerShell is worse than Perl. I refer to Perl as a
"write-only" language, meaning you can write it, but reading it
several months later is harder. Reading Perl code written by
someone else is even harder still.
Perl syntax is messy, but PowerShell to me looks like someone
puked on the screen. Also figuring out how to do things in
PowerShell is very hard because the documentation is so poor.
The QvwFileSelector.ps1 script I have provided, is very small and
I have carefully written it to be easy to understand. If you try
to write more complex scripts in PowerShell it gets messy very
fast.
I could have written this component in C# or Java, but then the
source code would not be as visible because the distributed
component would be compiled. I want people to be able to easily
see the code.
USAGE
Basically, use the two batch files:
Double click DisableMoveSizeCopyClone.bat to disable
Move/Size and Copy/Clone in documents that it will allow you to
select.
Double click EnableMoveSizeCopyClone.bat to enable
Move/Size and Copy/Clone in documents that it will allow you to
select.
You can also dobule click ManageMoveSizeCopyClone.js and it will
ask you whether you want to enable or disable before it displays
the file selection dialog. The batch files allow you to make
that choice up front.
QvwFileSelector.ps1 will open in Notepad if you double-click it.
Even if you run it with PowerShell, all it does is allow you to
select a file or files and then writes the file names to the
output. So, it is not useful to run by itself. It is invoked
internally by ManageMoveSizeCopyClone.js to allow you to select
the files you want to enable or disable.