Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


humbletech99

Member
  • Content Count

    4
  • Donations

    $0.00 
  • Joined

  • Last visited

Community Reputation

0 Neutral

About humbletech99

  1. err, that's that question, can you do something like that in VBScript? So far, I haven't found an answer, you have to pass in the predefined number of parameters to every function call (unless you pass in an array), you can't have it take 0 or 1 parameters it seems.
  2. Sorry guys, you seem to have misunderstood me, I'm not talking about WScript.Arguments as in arguments to the script itself, but actually a function within a script that I'd like to be able to call with either one parameter, "a message string", or no parameters, in which case the function would behave slightly differently. I suspect that I cannot call a func/sub defined with one arg without any args and that I must pass an empty string to do this
  3. I was wondering if there was some way that I can write a function or sub that can be called with or without arguments? I specifically want to be able to write a func/sub that can either accept 1 or 0 arguments and then handle that inside the func/sub to respond differently. I suspect that the best I can do is pass in an empty string, but I'd be happy to hear anyone's wisdom on this?
  4. Hi, I am currently writing some command line tools and was wondering what the most portable way of having a script called myscript.vbs that works like any normal command line program. I have tried so far testing for the name of the script host executable and if it's wscript, then doing in an if block shell.run "cscript.exe """ & Wscript.ScriptFullName & """" WScript.Quit However this opens the script in a new cmd window which is a bit of a problem, especially since you can't read the output before the window closes. I know I can change the default scripting host of the system to be cscript instead of wscript but it would be nice to do this in a more portable way such that I don't have to change the host environment to achieve this. Also, if I change the scripting host, then whenever I run any wscript orientated script that I want to run behind the scenes, it pops up a cmd box, which looks rubbish. Perhaps there is a way of doing the shell.run in the current window or some completely different way of doing this? shell.Exec? Or get cscript to execute in the current window instead of starting a new one? Any ideas welcome. Thanks
×
×
  • Create New...