FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Executing shell commands

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


Joined: 11 Oct 2005
Posts: 72
Location: Uppsala, Sweden

PostPosted: Thu Oct 13, 2005 12:56 am    Post subject: Executing shell commands Reply with quote

So, I found this line on the intarweb:

C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState

Which puts the computer in standby mode. I tried running it at a shell prompt - and the computer went to sleep.

Now, using the default Shutdown script as a template, I came up with this contraption:
[code:1]var widget = CreateQuestionDialog( "confirmation_");
widget.textualContent = "Enter standby?"
theTerminal.Push(widget);

function confirmation_OK(w)
{
var wsh = new ActiveXObject('WScript.Shell');
if(wsh)
wsh.Run("C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState");
}[/code:1]

But when I run it, nothing happens after the confirmation dialogue. Pointers? I'm REALLY scripting in the dark here. I have no clue about this stuff =)


[b][color=green]SOLVED[/color][/b]: Slashes must be escaped, thus: C:\\Windows\\System32\\rundll32.exe...


Last edited by teetow on Thu Oct 13, 2005 1:33 am; edited 2 times in total
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 13, 2005 12:59 am    Post subject: Reply with quote

I'm not sure. Could you please open the Script log? It's a simple text file that you can access from the tray icon.

Also, did you make sure to check your new item under Phone Events, and click Apply/OK?

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
teetow
Senior Member


Joined: 11 Oct 2005
Posts: 72
Location: Uppsala, Sweden

PostPosted: Thu Oct 13, 2005 1:00 am    Post subject: Reply with quote

Something did show up in the event log, though. I'm not sure if it's related or not (it's in swedish, I'm afraid).

Det går inte att hitta en beskrivning för händelse-ID 0 i källan Salling Clicker. Den lokala datorn har eventuellt inte nödvändig registerinformation eller meddelande-DLL-filer som behövs för att visa meddelanden från en fjärrdator. Kanske kan du använda flaggan /AUXSOURCE= om du vill se den här beskrivningen. Mer information om detta finns i Hjälp- och supportcenter. Ytterligare information: Manufacturer = SONY ERICSSON.

------------ and another one -------------

Det går inte att hitta en beskrivning för händelse-ID 0 i källan Salling Clicker. Den lokala datorn har eventuellt inte nödvändig registerinformation eller meddelande-DLL-filer som behövs för att visa meddelanden från en fjärrdator. Kanske kan du använda flaggan /AUXSOURCE= om du vill se den här beskrivningen. Mer information om detta finns i Hjälp- och supportcenter. Ytterligare information: Model = AAB-1021012-BV.
Back to top
View user's profile Send private message
teetow
Senior Member


Joined: 11 Oct 2005
Posts: 72
Location: Uppsala, Sweden

PostPosted: Thu Oct 13, 2005 1:01 am    Post subject: Reply with quote

Here's the script log. I've made three attempts, so I guess it's relevant. Line 9 is my shell call.

Thu Oct 13 00:50:04 2005
Standby - (null)
[Line: 9 (3)] (null)

Thu Oct 13 00:52:21 2005
Standby - (null)
[Line: 9 (3)] (null)

Thu Oct 13 00:58:16 2005
Standby - (null)
[Line: 9 (3)] (null)

Edit: It's a menu command, not a phone event.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 13, 2005 1:06 am    Post subject: Reply with quote

These are completely normal. I log these things in order to better support new devices. Don't worry about it.

- jonas

[quote="teetow"]Something did show up in the event log, though. I'm not sure if it's related or not (it's in swedish, I'm afraid).

Det går inte att hitta en beskrivning för händelse-ID 0 i källan Salling Clicker. Den lokala datorn har eventuellt inte nödvändig registerinformation eller meddelande-DLL-filer som behövs för att visa meddelanden från en fjärrdator. Kanske kan du använda flaggan /AUXSOURCE= om du vill se den här beskrivningen. Mer information om detta finns i Hjälp- och supportcenter. Ytterligare information: Manufacturer = SONY ERICSSON.

------------ and another one -------------

Det går inte att hitta en beskrivning för händelse-ID 0 i källan Salling Clicker. Den lokala datorn har eventuellt inte nödvändig registerinformation eller meddelande-DLL-filer som behövs för att visa meddelanden från en fjärrdator. Kanske kan du använda flaggan /AUXSOURCE= om du vill se den här beskrivningen. Mer information om detta finns i Hjälp- och supportcenter. Ytterligare information: Model = AAB-1021012-BV.[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
teetow
Senior Member


Joined: 11 Oct 2005
Posts: 72
Location: Uppsala, Sweden

PostPosted: Thu Oct 13, 2005 1:12 am    Post subject: Reply with quote

Ah =)

So... No ideas on why no workie? What kinda debugging tools are actually avaliable for this sorta thing?
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 13, 2005 1:12 am    Post subject: Reply with quote

The "null" values here means that we got no information about the type of error that occurred. Bummer.

I haven't tried the command line you're using. Does it pop up any UI on the computer screen?

Best.
--
Jonas

[quote="teetow"]Here's the script log. I've made three attempts, so I guess it's relevant. Line 9 is my shell call.

Thu Oct 13 00:50:04 2005
Standby - (null)
[Line: 9 (3)] (null)

Thu Oct 13 00:52:21 2005
Standby - (null)
[Line: 9 (3)] (null)

Thu Oct 13 00:58:16 2005
Standby - (null)
[Line: 9 (3)] (null)

Edit: It's a menu command, not a phone event.[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
teetow
Senior Member


Joined: 11 Oct 2005
Posts: 72
Location: Uppsala, Sweden

PostPosted: Thu Oct 13, 2005 1:17 am    Post subject: Reply with quote

Bah, I'm a minute too late every time =P

If you type

[b]C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState[/b]

at a regular CMD prompt, the computer pops off to sleep without hassle. It's the same effect as start > shut down > sleep, but instant. I've confimed that it works. This is why I'm so confused - the wsh.Run line works with other stuff like [b]wsh.Run("net send localhost Hello, World.");[/b]
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 13, 2005 1:26 am    Post subject: Reply with quote

I think I've got it... You must escape the backslashes. Try this:

"C:\\Windows\\System32\\rundll32.exe powrprof.dll,SetSuspendState"

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
teetow
Senior Member


Joined: 11 Oct 2005
Posts: 72
Location: Uppsala, Sweden

PostPosted: Thu Oct 13, 2005 1:30 am    Post subject: Reply with quote

OMIGOD JOO ROOLZ SALLING FTW!

...And similar hackeresque expletives. I guess I should have thought of that, but then again I have 20/20 hindsight.

Much, much appreciated. I'll keep toying with this during the weekend, the Media Player Classic remote is my primary objective.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 13, 2005 1:36 am    Post subject: Reply with quote

Well. You rock, too. :-) Just let me know if you need help with something. I'll try to provide assistance to the best of my abilities.

Cheers.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 20, 2005 10:54 pm    Post subject: Reply with quote

teetow,

Could you make the suspend script available for download? It'd be cool for people who want it to grab it from you until I build it in.

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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