FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Batch scripting with Salling Clicker

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows
View previous topic :: View next topic  
Author Message
soldstatic
Newbie


Joined: 24 Jan 2008
Posts: 16

PostPosted: Thu Jan 24, 2008 2:26 am    Post subject: Batch scripting with Salling Clicker Reply with quote

Hey everyone, I'm new to Salling Clicker, but I'm already sold on it! Going to buy it if I can just figure out how to do a few things.

Basically, I want to create my own scripts that run batch scripts. I'm on Win XP obviously, and I have a bunch of scripts I've already made. I'd like to be able to just run some of the start.bat type scripts I've made.

I thought I could just edit the shutdown script, but alas no luck. Here's what I have for a script that starts bitcomet. The actual command to start bit comet is ran by startBitcomet.bat which is located here:
[quote]C:\Documents and Settings\Andy\My Documents\sms functions\stopBitcomet.bat[/quote]
So I tried:
[code:1]var widget = CreateQuestionDialog( "confirmation_");
widget.textualContent = "Turn Bit Comet on or off? (OK for on, Cancel for off)"
theTerminal.Push(widget);

function confirmation_OK(w)
{
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run("C:\Documents and Settings\Andy\My Documents\sms functions\startBitcomet.bat");
}

function confirmation_Cancel(w)
{
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run("C:\Documents and Settings\Andy\My Documents\sms functions\stopBitcomet.bat");
}
[/code:1]


[quote]<?xml version="1.0" encoding="utf-8"?>

<ClickerScript>
<Path>startBitcomet.js</Path>
<Author>Andy Holt</Author>
<Category>System</Category>
<Description>Controls Bit Comet</Description>
<UUID>d8a55180-ca11-11dc-95ff-0800200c9a66</UUID>
<Title>Bit Comet</Title>
<Type>ClickerItem</Type>
<URL>http://clicker.salling.com</URL>
<Version>1.0</Version>
</ClickerScript>

[/quote]


Can anybody help me? Once I am able to run one batch script, I'm sure I can create my own to run whatever scripts I make later.
Back to top
View user's profile Send private message
soldstatic
Newbie


Joined: 24 Jan 2008
Posts: 16

PostPosted: Thu Jan 24, 2008 7:47 am    Post subject: Reply with quote

I figured it out. FYI if anyone wants to just run a program (or script in my case) you can use the following:

[quote] var shell = new ActiveXObject("Shell.Application");
shell.ShellExecute("C:\\Documents and Settings\\Andy\\My Documents\\sms functions\\startBitcomet.bat");[/quote]

So my script that starts bitcomet if you click ok, and stops it if you click cancel/no, now reads:

[code:1]var widget = CreateQuestionDialog( "confirmation_");
widget.textualContent = "Turn Bit Comet on or off? (OK for on, Cancel for off)"
theTerminal.Push(widget);

function confirmation_OK(w)
{
var shell = new ActiveXObject("Shell.Application");
shell.ShellExecute("C:\\Documents and Settings\\Andy\\My Documents\\sms functions\\startBitcomet.bat");
}

function confirmation_Cancel(w)
{
var shell = new ActiveXObject("Shell.Application");
shell.ShellExecute("C:\\Documents and Settings\\Andy\\My Documents\\sms functions\\stopBitcomet.bat");
}[/code:1]




Of course, I have some other stuff happen in my startBitcomet.bat and stopBitcomet.bat. You could change the above code to:

[quote] var shell = new ActiveXObject("Shell.Application");
shell.ShellExecute("C:\\Documents and Settings\\Andy\\My Documents\\sms functions\\startBitcomet.bat");[/quote]

So my script that starts bitcomet if you click ok, and stops it if you click cancel/no, now reads:

[code:1]var widget = CreateQuestionDialog( "confirmation_");
widget.textualContent = "Turn Bit Comet on or off? (OK for on, Cancel for off)"
theTerminal.Push(widget);

function confirmation_OK(w)
{
var shell = new ActiveXObject("Shell.Application");
shell.ShellExecute("C:\\Program Files\\BitComet\\BitComet.exe");
}

function confirmation_Cancel(w)
{
var shell = new ActiveXObject("Shell.Application");
shell.ShellExecute("taskkill /im BitComet.exe");
}[/code:1]

You can then replace the "C:\Program Files\BitComet\BitComet.exe" piece with the path to whatever program or command you want to run, and change the taskkill line to instead of reading bitcomet.exe have the name of the process that you want to kill (which you can find by ctrl+alt+del 'ing , right clicking the name of the running application, clicking go to process. That should let you find the name of the process running.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group