Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Highlighted
falko_thom
New Contributor III

How to get /NoSecurity into a .vbs file

Good morning,

i am using windows task scheduler and a .vbs file to automatically run some qlikview files.

Here is the code of the .vbs file:

dim fso

dim MyDoc

dim MyApp

dim qvwVerzeichnis

dim vVerzeichnis

dim vDirectory

dim vDatei

Dim intZaehler

set MyApp = CreateObject("QlikTech.QlikView")

set fso = CreateObject("Scripting.FileSystemObject")

'Set fso = New FileSystemObject

qvwVerzeichnis = "\\10.232.130.232\QlikView\data\02_Betriebsorganisation\TELSTAR\"

REM TEAMSTATISTIK

  intZaehler = 0

  SET vVerzeichnis = fso.GetFolder("\\DENW0043VF001\43daten\000Versicherungstechnik\ACD-Reporting\Teamreports\")

  vDirectory = "\\DENW0043VF001\43daten\000Versicherungstechnik\ACD-Reporting\Teamreports\"

  'Anzahl der Dateien im Ordner (ohne Unterverzeichnisse):

  For Each vDatei In vVerzeichnis.Files

  'Prüfen, ob es eine Datei ist, die im Namen "Advocard Teamauswertung I HalfHr Prozent" enthält

  If Mid(vDatei.Name, 1, Len("Advocard Teamauswertung I HalfHr Prozent")) = "Advocard Teamauswertung I HalfHr Prozent" Then

       '-->Dateizähler erhöhen:

       intZaehler = intZaehler + 1

  End If

  Next

REM QVW-Datei Teamreports öffnen und Skript starten

if intZaehler >0 then

     set MyDoc = MyApp.OpenDoc (qvwVerzeichnis + "qvdACR_Teamstatistik.qvw","","")

     set ActiveDocument = MyDoc

     ActiveDocument.Reload

     Set MyDoc = Nothing

     REM eingelesene Dateien in das Archivverzeichnis verschieben

     fso.MoveFile vDirectory + "Advocard Teamauswertung I HalfHr Prozent*.xls", vDirectory + "archiv\"

end if

REM TELSTAR-Datenmodell

  'QVW-Datei mit Datenmodell öffnen, Skript starten und speichern

  set MyDoc = MyApp.OpenDoc (qvwVerzeichnis + "TELSTAR_datenmodell.qvw","","")

  set ActiveDocument = MyDoc

  ActiveDocument.Reload

  ActiveDocument.Save

REM TELSTAR

  'QVW-Datei TELSTAR öffnen, Skript starten und speichern

  qvwVerzeichnis = "\\10.232.130.232\QlikView\data\Prod\TELSTAR\" ' für produktiv auskommentieren

  set MyDoc = MyApp.OpenDoc (qvwVerzeichnis + "TELSTAR.qvw","","")

  set ActiveDocument = MyDoc

  ActiveDocument.Reload

  ActiveDocument.Save

MyDoc.GetApplication.Quit 'Qlikview schließen

Set MyDoc = Nothing

Set MyApp = Nothing

Set fso = Nothing

As one can see, i am using vbs because I have to check whether there is at least a file in the directory, run the qvw and then move the files to a different directory.

Everything works fine except for the last file Telstar.qvw. Only for this one qv asks to manually replace the file:

150624 replace telstar.jpg

All other files are automatically saved even without using 'ActiveDocumentSave'.

In different discussions I read about '/NoScript'. Is it possible to add this command in the .vbs file. If so - where?

Or is there any other possibility to run these kind of scripts automatically.

regards, Falko

1 Solution

Accepted Solutions
oleg_orlov
Contributor

Re: How to get /NoSecurity into a .vbs file

If so, problem may be solved by simply saving document before reload:

ActiveDocument.SaveAs ActiveDocument.GetPathName;

ActiveDocument.Reload;

ActiveDocument.Save;

ActiveDocument.CloseDoc;

13 Replies
Arjunarao
Honored Contributor II

Re: How to get /NoSecurity into a .vbs file

Check the size of the TELSTAR.qvw.

Try by giving TELSTAR.qvw to other file name which is running fine.

Hope this will help.

oleg_orlov
Contributor

Re: How to get /NoSecurity into a .vbs file

Hi, Thom!

Try to use SaveAs instead Save:

ActiveDocument.SaveAs(ActiveDocument.GetPathName());

Best regards,

Oleg Orlov

falko_thom
New Contributor III

Re: How to get /NoSecurity into a .vbs file

Thanks for the quick answers.

I tried both of them, but with no effect.

I figured out, that TELSTAR.qvw is saved when the script is started. I disabled the feature in my user settings, but it didn't help.

Any ideas?

oleg_orlov
Contributor

Re: How to get /NoSecurity into a .vbs file

Try to close the document. Test it only for TELSTAR.qvw (add rem to other code). And you should be sure that after using Reload method your macro is waiting while it will finish the reload.

JScript:

ActiveDocument.SaveAs(ActiveDocument.GetPathName());

ActiveDocument.CloseDoc();

VBScript:

ActiveDocument.SaveAs ActiveDocument.GetPathName;

ActiveDocument.CloseDoc

oleg_orlov
Contributor

Re: How to get /NoSecurity into a .vbs file

So you can try it without using Reload. If it works without reloading the problem can be with sequence of commands.

falko_thom
New Contributor III

Re: How to get /NoSecurity into a .vbs file

Hello Oleg,

thanks again for your answer.

This really is crazy.

Every time I execute the .vbs-script qlikview asks me to overwrite the file TELSTAR.qvw. I have to confirm that I want to overwrite the existing file.

Even renaming the file and using different code as written did not work.

Qlikview asks me to confirm overwriting the file just as the command 'ActiveDocument.Reload' is executed. Directly before running the qv script. (I added a REM in front of the line 'ActiveDocument.SaveAs ActiveDocument.GetPathName').

This is the only file where I am asked to confirm anything.

I really have no clue...

regards

oleg_orlov
Contributor

Re: How to get /NoSecurity into a .vbs file

You can turn off in User Preferences option Save Before Reload (Save tab).

falko_thom
New Contributor III

Re: How to get /NoSecurity into a .vbs file

already done

oleg_orlov
Contributor

Re: How to get /NoSecurity into a .vbs file

But if you open the document manually and run Reload are you asked to Save document?