<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Run a Command Line From Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683504#M673152</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hello Everyone! &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I have to run a Command Line to remove some variables (strings) from an external text file.&lt;/P&gt;&lt;P&gt;I just need to know if it is possible and how to write a Command Line into the Macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Mirco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Sep 2014 13:38:05 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-09-24T13:38:05Z</dc:date>
    <item>
      <title>Run a Command Line From Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683504#M673152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hello Everyone! &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I have to run a Command Line to remove some variables (strings) from an external text file.&lt;/P&gt;&lt;P&gt;I just need to know if it is possible and how to write a Command Line into the Macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Mirco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 13:38:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683504#M673152</guid>
      <dc:creator />
      <dc:date>2014-09-24T13:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Run a Command Line From Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683505#M673153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mirco,check this doc: &lt;A href="https://community.qlik.com/docs/DOC-4870"&gt;Useful Qlikview Macros&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are searching for the first example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 13:54:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683505#M673153</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2014-09-24T13:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Run a Command Line From Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683506#M673155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ruben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick answer,&lt;/P&gt;&lt;P&gt;I wasn't exactly &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;looking for that, because I have many string variables, then I would like to WRITE the command line directly into the Macro in order to set my Variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was also thinking to set some parameters, but I have no idea how to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mirco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 14:09:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683506#M673155</guid>
      <dc:creator />
      <dc:date>2014-09-24T14:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run a Command Line From Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683507#M673157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I thought you wanted to execute some bat that does the job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't done something like this (removing strings from external file) but but still I think it's possible, you can start with:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN class="kwd"&gt;Set&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; objFS &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; CreateObject&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"Scripting.FileSystemObject"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;strFile &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"Path\File.Extension"&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;Set&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; objFile &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; objFS&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;OpenTextFile&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;strFile&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;From there you'll need to find the vbscript code to do the work you wanted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;If you want a function to assign values you can use:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Function SetVariable(variable, value)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set v = ActiveDocument.Variables(variable)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; v.SetContent value, true&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 14:32:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683507#M673157</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2014-09-24T14:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Run a Command Line From Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683508#M673159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll try to make it easier for you, there should be some misunderstanding, &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;follow the command line I have to execute:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;EM&gt;Path\sbs.exe -c --remove Path\FileName.txt&amp;nbsp; &lt;STRONG&gt;StringToRemove&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;STRONG&gt;StringToRemove&lt;/STRONG&gt; is the string variable that i need to remove.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Is there a way to write it into my Macro? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Or is there a way to run a batch file with &lt;STRONG&gt;StringToRemove &lt;/STRONG&gt;as a parameter?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Mirco&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 14:55:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683508#M673159</guid>
      <dc:creator />
      <dc:date>2014-09-24T14:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Run a Command Line From Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683509#M673161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry Mirco, probably I still don't understand the question, I'll make a simple 'show value' example hoping will help you to find the solution...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a batch.bat file than contents:&lt;/P&gt;&lt;P&gt;echo %1&lt;/P&gt;&lt;P&gt;pause&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you create this macro:&lt;/P&gt;&lt;P&gt;SUB CallExample &lt;/P&gt;&lt;P&gt;CreateObject("WScript.Shell").Run("c:\Test\batch.bat MyMessage") &lt;/P&gt;&lt;P&gt;END SUB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Executing CallExample macro from a button in Qv will show 'MyMessage' in cmd windows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to make the parameter more dynamic you can use a function like:&lt;/P&gt;&lt;P&gt;Function GetVariable(variable)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set v = ActiveDocument.Variables(variable)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetVariable = v.GetContent.String&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can create the macro:&lt;/P&gt;&lt;P&gt;SUB CallExample &lt;/P&gt;&lt;P&gt;CreateObject("WScript.Shell").Run("c:\Test\batch.bat " &amp;amp; GetVariable("MyStringVar")) &lt;/P&gt;&lt;P&gt;END SUB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 15:25:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-a-Command-Line-From-Macro/m-p/683509#M673161</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2014-09-24T15:25:07Z</dc:date>
    </item>
  </channel>
</rss>

