PDA

View Full Version : running vbscript code without cmd console popping up



Cox
2013-11-27, 14:33
In my quest to gather USB stick drive serial number have come across vbscript code that I can run from python. when I run the code however, the popup is displayed and not desirable for the needed implementation. Have gone ahead and changed the vbscript into and exe and to run in silent mode without the pop, but running this within lianja still pops up window. Please check if silent mode is available overall.

action: a button click action in a custom python gadget.

yvonne.milne
2013-11-28, 10:29
Hi Cox,

This worked for me, without displaying a window:


gadget1.py


#
# Lianja custom python gadget "gadget1"
#
import Lianja
import subprocess
#---------------------------------------------------------------------------
# Define the class we need to handle the button click event
class MyButton(Lianja.Commandbutton):
def click(self):
subprocess.call("wscript.exe C:\Temp\writetofile.vbs")
#---------------------------------------------------------------------------
# Create the gadget and add in the controls
gadget1_gadget = Lianja.createObject("gadget1_gadget", "gadget")
gadget1_gadget.addobject("mybutton", "MyButton")
mybutton.caption = "Click me!"
#---------------------------------------------------------------------------
# Return the gadget to Lianja

returnvalue = gadget1_gadget

Regards,

Yvonne

Cox
2013-11-28, 13:57
Thanks, that sort it.