Author Topic: RunShell  (Read 3747 times)

codemunkeh

  • Guest
RunShell
« on: May 20, 2009, 08:46:18 AM »
Morning all.

Is it possible to launch external programs in Icechat v7 (VBscript)? Well yes it is, with the RunShell command. But for the life of me I can't get it to pass arguments to the program.

RunShell "C:\test.exe"   would work, but RunShell "C:\test.exe -flag" won't.

There's no error message, and the script continues executing.

I tried a snippet involving WScript.shell objects but obviously running within the context of Icechat means there's no WScript host.

So how would I pass a parameter to a program?

(FWIW, I'm trying to get certain actions to push notifications to Growl for Windows using the commandline tool)

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: RunShell
« Reply #1 on: May 20, 2009, 11:09:34 AM »
Paste your snippet using the WScript shell, there is a way to use it in IceChat, it will just need a little code-massaging.
The IceChat God

codemunkeh

  • Guest
Re: RunShell
« Reply #2 on: May 20, 2009, 12:45:27 PM »
I can't find the page with the exact snippet, but this is what's listed on MSDN for the Run method.

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad " & WScript.ScriptFullName

Which is meant to open the current script in notepad.
This causes a runtime error,
-- Script Engine Error:424:Object required: 'WScript': Line #225 --

The app in question is C:\growlnotify.exe but it's dying before the line with the app on it.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: RunShell
« Reply #3 on: May 20, 2009, 12:57:46 PM »
Code: [Select]
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad.exe -args"
The IceChat God

codemunkeh

  • Guest
Re: RunShell
« Reply #4 on: May 20, 2009, 01:12:05 PM »
That works great, cheers.