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, 11: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