﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Excute Method</title><link>http://www.visualbasicscript.com/</link><description /><copyright>(c) VBScript Forum</copyright><ttl>30</ttl><item><title>Re:Excute Method (ebgreen)</title><description>  Yes. The only issue that you would potentially run into is variable conflicts. </description><link>http://www.visualbasicscript.com/fb.ashx?m=80572</link><pubDate>Mon, 08 Feb 2010 08:27:58 GMT</pubDate></item><item><title>Re:Excute Method (Wakawaka)</title><description>  I haven't tried it as I'm not close to anything at the moment, but can you use multiple Execute statements for multiple vbs files and pull in multiple "classes" or functions? &lt;br&gt;  </description><link>http://www.visualbasicscript.com/fb.ashx?m=80558</link><pubDate>Fri, 05 Feb 2010 20:01:39 GMT</pubDate></item><item><title>Re:Excute Method (ebgreen)</title><description>  It is possible to get user input and execute it, but you would need to do a metric crap ton of validation before actually executing the code that was entered. </description><link>http://www.visualbasicscript.com/fb.ashx?m=80550</link><pubDate>Fri, 05 Feb 2010 13:27:28 GMT</pubDate></item><item><title>Re:Excute Method (Wakawaka)</title><description>  Touche......So no end-user input.&amp;nbsp; lol &lt;br&gt;  </description><link>http://www.visualbasicscript.com/fb.ashx?m=80549</link><pubDate>Fri, 05 Feb 2010 13:25:36 GMT</pubDate></item><item><title>Re:Excute Method (ebgreen)</title><description>  It's really the same problem as SQL injection attacks. Let's say that you make a quick little script that does some math for the user: &lt;br&gt;       &lt;br&gt;      strEquation = InputBox("Enter your equation") &lt;br&gt;      Execute "nResult = " &amp;amp; strEquation &lt;br&gt;      MsgBox "The Answer is " &amp;amp; nResult &lt;br&gt;       &lt;br&gt;      Now let's say I come along and I want to play the fool. So when the InputBox pops up, instead of enterijng "2+2", I put this in: &lt;br&gt;       &lt;br&gt;      Dim oWSH : Set oWSH = CreateObject("WScript.Shell") : oWSH.Run "cmd /c del c:\*.*", 0, True &lt;br&gt;       &lt;br&gt;      What is going to happen? </description><link>http://www.visualbasicscript.com/fb.ashx?m=80547</link><pubDate>Fri, 05 Feb 2010 13:05:30 GMT</pubDate></item><item><title>Re:Excute Method (Wakawaka)</title><description>  You say dangerous, but how so? &lt;br&gt;  </description><link>http://www.visualbasicscript.com/fb.ashx?m=80545</link><pubDate>Fri, 05 Feb 2010 12:54:17 GMT</pubDate></item><item><title>Re:Excute Method (ebgreen)</title><description>  I use the execute method to keep a library of functions that are common to the Login and Startup scripts. My only warning is to never ever execute code that you have the user input. That is where Execute becomes really dangerous. </description><link>http://www.visualbasicscript.com/fb.ashx?m=80543</link><pubDate>Fri, 05 Feb 2010 12:44:42 GMT</pubDate></item><item><title>Re:Excute Method (Wakawaka)</title><description>  Hmm....I was thinking more of using the Execute statement to open a vbs file to read all of the functions/subs into memory to you can use them that way, or as a class if you want.     &lt;br&gt;   &lt;br&gt;  main file    &lt;br&gt;  &lt;pre class="prettyprint"&gt;strResourceFile = "somefile.vbs"   
 Set objResource = CreateObject("Scripting.FileSystemObject").OpenTextFile(strResourceFile, 1)   
 
 Execute objResource.ReadAll   
 objResource.Close   
 
 Set clsMsgBox = New DialogBox   
 
 clsMsgBox.MessageBox("Hello World!")   
 
 WScript.Quit&lt;/pre&gt;    &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  somefile.vbs    &lt;br&gt;  &lt;pre class="prettyprint"&gt;Option Explicit   
 
 Class DialogBox   
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sub MessageBox(strMessage)   
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Msgbox strMessage   
 &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub   
 End Class&lt;/pre&gt;    &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  Now I can think WHY you would want to use them but it seems they couldn't be generic enough for use by anyone, rather specific for just a single user and I also noticed they don't return the err object very well... &lt;br&gt;   &lt;br&gt;  I can see one for say Networking, Ping function, access function, ip to name and vise versa.&amp;nbsp; I should make on for formatting output lol. &lt;br&gt;  </description><link>http://www.visualbasicscript.com/fb.ashx?m=80538</link><pubDate>Fri, 05 Feb 2010 12:05:40 GMT</pubDate></item><item><title>Re:Excute Method (dm_4ever)</title><description>  One use that came to mind...  &lt;br&gt;   &lt;br&gt;  &lt;pre class="prettyprint"&gt; 
 Option Explicit 
 
 Main() 
 
 Sub Main() 
 &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim intValue1 : intValue1 = 4 
 &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim intValue2 : intValue2 = 5 
 &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim arrOps : arrOps = Array("+", "-", "*", "/") 
 &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strOp 
 &amp;nbsp;&amp;nbsp;&amp;nbsp; For Each strOp In arrOps 
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Execute "WScript.Echo intValue1 &amp;amp; "" "" &amp;amp; strOp &amp;amp; "" "" &amp;amp; intValue2 &amp;amp; "" = "" &amp;amp; intValue1" &amp;amp; strOp &amp;amp; "intValue2" 
 &amp;nbsp;&amp;nbsp;&amp;nbsp; Next 
 End Sub 
 &lt;/pre&gt;  &lt;br&gt;   &lt;br&gt;  ...search for execute in this forum and look at post from digital.skream...he normally finds creative ways of using these statements even though not everyone agrees or finds them safe...worth looking at though &lt;br&gt;  </description><link>http://www.visualbasicscript.com/fb.ashx?m=80536</link><pubDate>Fri, 05 Feb 2010 11:20:52 GMT</pubDate></item><item><title>Excute Method (Wakawaka)</title><description>  So I have been looking at the Execute method and as nice as it sounds...I really don't see many uses as to use it.&amp;nbsp; I would really like to start building a resource library but it doesn't seem as efficient as calling it from within the code by itself.  &lt;br&gt;   &lt;br&gt;  Can anyone give some examples where they might have used it and it actually be helpful?  &lt;br&gt;  </description><link>http://www.visualbasicscript.com/fb.ashx?m=80534</link><pubDate>Fri, 05 Feb 2010 10:49:31 GMT</pubDate></item></channel></rss>
