What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Help writing a batch file

Pages: (2): « First « 1 [ 2 ] Last »
Help writing a batch file
Author: Message:
Jarrod
Veteran Member
*****

Avatar
woot simpson

Posts: 1304
Reputation: 20
– / Male / Flag
Joined: Sep 2006
RE: Help writing a batch file
quote:
Originally posted by CookieRevised

code:
@ECHO OFF
tasklist | find /i "synergys.exe" 1>NUL 2>&1
IF %ERRORLEVEL% EQU 0 (
     taskkill /f /t /im synergys.exe
     "c:\program files\ultramon\ultramon.exe" /e
)
IF %ERRORLEVEL% EQU 1 (
     "c:\program files\synergy\synergys.exe" -a pieceofcrap:24800 -d FATAL
     "c:\program files\ultramon\ultramon.exe" /d
)



use the start command instead.
so
start "c:\program files\synergy\synergys.exe" -a pieceofcrap:24800 -d FATAL
start  "c:\program files\ultramon\ultramon.exe" /d


[Image: 5344.png]
[Image: sig.png]

A.k.a. The Glad Falconer














04-22-2009 03:35 AM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
O.P. RE: Help writing a batch file
had to modify that slightly to get it to work properly to:

start c:\progra~1\synergy\synergys.exe -a pieceofcrap:24800 -d FATAL

double quotes for start as the first param indicate the title of a new prompt window, and it went downhill from there. It runs perfectly now. All I need now is a DVI cable that doesn't cost an arm and a leg...
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
04-22-2009 04:26 AM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Help writing a batch file
quote:
Originally posted by MeEtc
Having a problem with the second half of the script with synergys.exe. The batch file won't continue running because synergys.exe is still running. ultramon.exe won't start until synergys.exe stops. Any way around that?
What second half? What you mean by "synergys is still running"? You mean taskkill doesnt kill the synergys process ?

I ask this because it makes little sense that by adding START to everything it all of a sudden does work. Because you should not explicitly need the START command to start a program!

You only explicitly need START if you want to alter the console window like the title, minimized state, change the priority, wait for the app to quit, etc...

It should work perfectly without it, provided taskkill does kill the process in time. For that reason, and only that reason, it might be a good idea to build in a wait period before running "c:\program files\ultramon\ultramon.exe" /e so that taskkill has some time to kill the synergys process.

As that is the problem from what I understand from your post.

So, simply adding START like Jarod said doesn't make any difference and wont fix anything and you will most likely experience the same problem another time (when taskkill needs some more time than instant for whatever reason to kill synergys).

So instead of adding START everywhere, try to change:
   taskkill /f /t /im synergys.exe
to
   start /wait taskkill /f /t /im synergys.exe
this should pause the batch until taskkill has done its job instead of immediatly executing the next line (starting ultramon).

This post was edited on 04-23-2009 at 07:30 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-23-2009 06:54 AM
Profile PM Find Quote Report
Vilkku
Veteran Member
*****

Avatar

Posts: 1411
Reputation: 27
35 / Male / Flag
Joined: Mar 2003
RE: Help writing a batch file
Was about to comment on that part you just edited out, Cookie... the reason I (and I bet most other) use Ultramon is to extend the taskbar to the second monitor. If you know another (freeware :o) application that does it, then I'd be very interested in it (I know there is one but it doesn't have the proper Vista skin in the free version and it also for some reason wants to add stuff like the clock to the second taskbar).

When it comes to Synergy, it's an application to share one keyboard and mouse between many computers (essentially making the second computer act like another monitor for the first one, without being able to move applications between computers).
[Image: signature.php]
04-23-2009 07:27 AM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Help writing a batch file
quote:
Originally posted by Vilkku
Was about to comment on that part you just edited out, Cookie...
Yeah sorry, wasn't realy relevant to the thread...

quote:
Originally posted by Vilkku
the reason I (and I bet most other) use Ultramon is to extend the taskbar to the second monitor. If you know another (freeware :o) application that does it, then I'd be very interested in it (I know there is one but it doesn't have the proper Vista skin in the free version and it also for some reason wants to add stuff like the clock to the second taskbar).
On my other computer the video drivers has that build in. Nevertheless, I don't like having an 'extended' taskbar. For that matter, I know Ultramon has some other nifty features, but all features I personaly would never use. So its kind of useless to me.... hence my (removed) comments.

quote:
Originally posted by Vilkku
When it comes to Synergy, it's an application to share one keyboard and mouse between many computers (essentially making the second computer act like another monitor for the first one, without being able to move applications between computers).
Yeah, looked it up. Sound like a cool thing and very innovative/original I think to use TCP/IP. Although by the way it works, it sure must have problems with certain programs and stuff. But again no use for me as I have a 2 'Blackboxes' for that (second hand of course, way too expensive otherwise :p) of which one is a matrix switch, so I can have any monitor for any PC. Should have known about senergys before I bought them, damn...

EDIT: although, now that I think about it, don't you need all the connected PCs to be running if you want to use a particular monitor in that case? Which is a no-go in my case... blah... those two 'blackboxes' makes my whole desktop a bit cooler (more lights and switches and stuff you know :D)

This post was edited on 04-23-2009 at 07:43 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-23-2009 07:37 AM
Profile PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
RE: Help writing a batch file
quote:
Originally posted by CookieRevised
What second half? What you mean by "synergys is still running"? You mean taskkill doesnt kill the synergys process ?

I ask this because it makes little sense that by adding START to everything it all of a sudden does work. Because you should not explicitly need the START command to start a program!

Ehm as far as I know you do...

try this as a batch file:

code:
mspaint.exe
notepad.exe
pause
start mspaint.exe
start notepad.exe


it will only start notepad after paint is closed...
but the second part will start them both...
04-23-2009 12:01 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
O.P. RE: Help writing a batch file
Yes foaly, that's exactly whgats happening. The batch file was waiting for synergys.exe to finish running before running the coomand to shut off the secondary monitor. As I said earlier, I have it working now, and that's all that really matters.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
04-23-2009 03:12 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: Help writing a batch file
quote:
Originally posted by foaly
quote:
Originally posted by CookieRevised
What second half? What you mean by "synergys is still running"? You mean taskkill doesnt kill the synergys process ?

I ask this because it makes little sense that by adding START to everything it all of a sudden does work. Because you should not explicitly need the START command to start a program!
Ehm as far as I know you do...
try this as a batch file:
code:
mspaint.exe
notepad.exe
pause
start mspaint.exe
start notepad.exe
it will only start notepad after paint is closed...
but the second part will start them both...
Ah, programs opening a window and keep on running... forgot about that. I never use a batch file to start a windows based program or program which keeps running and I didn't knew that ultramon or synergys with those command line parameters would still be running after doing their thing, stupid me.

For all other normal batch file stuff (as I like to call it now :p) you should not use START though as it opens the program in another console thread and thus you can't control, check or redirect the output or even know if program A starts before program B.

You learn something new every day. Thanks foaly

This post was edited on 04-23-2009 at 10:24 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-23-2009 10:22 PM
Profile PM Find Quote Report
Jarrod
Veteran Member
*****

Avatar
woot simpson

Posts: 1304
Reputation: 20
– / Male / Flag
Joined: Sep 2006
RE: Help writing a batch file
quote:
Originally posted by foaly
quote:
Originally posted by CookieRevised
What second half? What you mean by "synergys is still running"? You mean taskkill doesnt kill the synergys process ?

I ask this because it makes little sense that by adding START to everything it all of a sudden does work. Because you should not explicitly need the START command to start a program!

Ehm as far as I know you do...

try this as a batch file:

code:
mspaint.exe
notepad.exe
pause
start mspaint.exe
start notepad.exe


it will only start notepad after paint is closed...
but the second part will start them both...
that's why I said use start:p, I just wasn't fast enough

[Image: 5344.png]
[Image: sig.png]

A.k.a. The Glad Falconer














04-23-2009 10:39 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On