Page 1 of 1

Run script from another

Posted: Wed Dec 21, 2011 5:32 am
by jacco van der Ven
Is it possible to run an script from another script.
example:
I have an script what can send an message to my iPhone, this is an function.
Now from another script where the trigger is I want to run the function in that other script to send it and use the variable(message) from the trigger script?

Is this possible and how?

Regards, Jacco

Re: Run script from another

Posted: Wed Dec 21, 2011 4:10 pm
by Richard Naninck
Yes, no problem. If you use scripts that start and stop each run, this makes sense. You can also setup scripts with a Do - Loop construction looking for commands to work out. Many examples in the scripts department.

SetPropertyValue "Your Script Device.State", "Running"

Re: Run script from another

Posted: Thu Dec 22, 2011 1:55 am
by jacco van der Ven
Thanks, Richard, this is also an good solution, but is it also possible from the vscript himself?

I have two scripts:

Motion.vbs and SendProwlMessage.vbs

What I want is to run SendProwlMessage.vbs from the motion script and not via Housebot.
so in Motion is the message variable that I will send with the SendProwlMessage.vbs script.

Jacco

Re: Run script from another

Posted: Thu Dec 22, 2011 6:51 am
by Richard Naninck
Well, that's exactly what I mean.

If your motion script wants to start the Sendmessage script just do something like this:

If motion = true then
SetPropertyValue "SendMessage Script Device.State", "Running"
End If

Re: Run script from another

Posted: Thu Dec 22, 2011 7:12 am
by jacco van der Ven
What I meaned is this code in the motion script, what you discribed run the second script with an script device in Housebot.
I want to do it directly in vbscript without Housebot.

Set objShell = CreateObject("WScript.Shell")

If Motion = "On" Then
Message = "Motion detected"
objShell.Run "C:\SendProwlMessage.vbs Message " & Message
Set objShell = Nothing

Re: Run script from another

Posted: Thu Dec 22, 2011 1:19 pm
by Richard Naninck
OK, I guess I misread you but I still don't really know what you mean. Did you fix it now with the example code you published?
If not and you still have questions, you could send me an email in Dutch and go from there..