Page 1 of 2 12>
Topic Options
#161207 - 2006-04-26 09:35 PM How to order the startup of programs after login
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
I need to order the startup of two applications on a few specialized computers. I was thinking of putting a shortcut to a KiXtart script in the startup folder and writing a script that would shell the original Shortcut paths in the order I specify. (With a sleep between programs)

Is the the proper way of doing this?
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#161208 - 2006-04-26 11:04 PM Re: How to order the startup of programs after login
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you name them 1.lnk, 2.lnk, etc, it will run them in that order.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#161209 - 2006-04-26 11:15 PM Re: How to order the startup of programs after login
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
Does the startup process wait until 1.lnk is finished loading before loading 2.lnk?
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#161210 - 2006-04-26 11:27 PM Re: How to order the startup of programs after login
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
no it doesn't. you could do like you said and spawn the processes yourself though. kick the one process off first and then run a timed loop to check for the existence of a process and once it exists, you could kick off the other prog...
Top
#161211 - 2006-04-26 11:44 PM Re: How to order the startup of programs after login
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
Can you expand on how to check for the running process before stepping to the next executable?
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#161212 - 2006-04-26 11:50 PM Re: How to order the startup of programs after login
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
I don't know how reliable this function is as I haven't used it and it seems to rely on quite a few dependencies:

http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=82419&an=0&page=24#82419

if this doesn't work for you... you can also download a tool called PSLIST.exe if you don't already have it which lists all process running on a machine and you can call it using RUN or SHELL and then couple that with WSHPIPE() to get the results from the command into an array and then check for the existence of your process....

btw, WSHPIPE() is something i live by... love it. =D

Top
#161213 - 2006-04-26 11:51 PM Re: How to order the startup of programs after login
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
PSLIST - http://www.sysinternals.com/Utilities/PsList.html
Top
#161214 - 2006-04-26 11:53 PM Re: How to order the startup of programs after login
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
http://www.kixtart.org/UDF/UDF_lister.php?what=post&code=82991
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#161215 - 2006-04-26 11:54 PM Re: How to order the startup of programs after login
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
or a light version
Code:
Function EnumProc($exe)
Dim $winmgmts, $ExecQuery, $Proc, $ID, $GetObject
$winmgmts = "winmgmts:{impersonationLevel=impersonate}!//" + @wksta
$ExecQuery = "select * from Win32_Process where Name='" + "$exe'"
$GetObject = GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Proc in $GetObject
$ID = $Proc.ProcessID
$EnumProc = $ID + "|" + $EnumProc
Next
$EnumProc = Left($EnumProc,Len($EnumProc)-1)
$GetObject = ''
EndFunction

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#161216 - 2006-04-26 11:56 PM Re: How to order the startup of programs after login
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
yeah... the easy way always works the best anyways. =P
Top
#161217 - 2006-04-27 12:12 AM Re: How to order the startup of programs after login
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You could even do it this way...
Code:

CLS
BREAK ON
For $i=1 to 4
$i
RUN $location+'\'+$i+'.lnk'
NEXT
get $



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#161218 - 2006-04-27 12:22 AM Re: How to order the startup of programs after login
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
Kent, will that step through and wait intil the first "1" is finished before moving on to "2"?
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#161219 - 2006-04-27 12:25 AM Re: How to order the startup of programs after login
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Shell has better odds than run does.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#161220 - 2006-04-27 01:06 AM Re: How to order the startup of programs after login
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
yeah Shell is supposed to wait before until it's finished before executing BUT you still may run into a problem with either method; let me explain. I've seen programs that have run like the ones you describe (one needing to be started before the other) and simply checking for the existence of a process may not do. You may need to add a time offset in there if the first program doesn't totally load until after $x amount of time, do you know what I mean? just something to think about in case whatever method you choose doesn't appear to work initially...
Top
#161221 - 2006-04-27 07:31 AM Re: How to order the startup of programs after login
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
But, Les is correct in the sense that you can do a START /WAIT for the execution of the program to complete before going on to the next program..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#161222 - 2006-04-27 08:22 AM Re: How to order the startup of programs after login
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Yes but those options would leave KiX running until the user closed those apps.

A run with a timer or some other test to confirm if the first app is started completely before launching the other might be better.
 
What applications are these that it is so critical?
 

Top
#161223 - 2006-04-27 08:04 PM Re: How to order the startup of programs after login
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
These applications are running on police cars and fire/ems vehicles. They are the dispatch program and the geo-mapping program. The mapping program must load first before the dispatch program can load because their is an interface between the two that will fail if this order is not maintained.

There are many ideas here. I'm not quite sure how to start. If I had to put this into pseudo code I would say:

Code:
  

RUNorSHELL "c:\mappingprogram.exe"
?check for running process
?if process not running check again after 5 seconds (loop)
?next
sleep 10
RUNorSHELL "c:\caddispatchprogram.exe"
exit



Sorry, I just don't know how to put all of these recommendations together in proper code, yet.
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#161224 - 2006-04-27 09:09 PM Re: How to order the startup of programs after login
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
You're running full blown Windows on these cars that runs KiXtart too? or the Dispatch PC's that are used to do dispatch work run this?

Do you know what process or other item to look for to make sure the other program is started okay?

Top
#161225 - 2006-04-27 10:45 PM Re: How to order the startup of programs after login
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
These are MDT (Mobile Data Terminals) that are full blown Intel 1.6Ghz Centrino CPU, 512MB ran, running Windows XP SP2. They are Computers that are hardwired into each vehicle (power converter runs off battery/alternator). I have two "wireless" solutions that bounce between one another, which ever is available. (WiFi first, then Data Radio 700Mhz)

I am trying to automate the startup of these programs so when an officer turns on an MDT the computer will load all applications for them without user intervention.

The names of each process matches the name of the executable.
I.E. MobiLynxMO.exe, vm.exe
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#161226 - 2006-04-28 12:08 AM Re: How to order the startup of programs after login
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
Well as long as your vehicles are running full blown Windows, I don't see a problem with them being in a police car but that's a pretty cool setup I must say. =P Your pseudo code (IMO) should look like this:

Code:

$prog1 = 'exe1'
$prog2 = 'exe2'

SHELL "%path_to_exe1%\"+$prog1

While @ERROR <> 0
EnumProc($prog1)
Sleep 1
Loop

;; Now you may want to set a sleep offset depending on
;; whether the condition exists where the program, even
;; though it may be started, needs to wait a few secs
;; before kicking off the other...

SHELL "%path_to_exe2%\"+$prog2

Function EnumProc($exe)
Dim $winmgmts, $ExecQuery, $Proc, $ID, $GetObject
$winmgmts = "winmgmts:{impersonationLevel=impersonate}!//" + @wksta
$ExecQuery = "select * from Win32_Process where Name='" + "$exe'"
$GetObject = GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Proc in $GetObject
$ID = $Proc.ProcessID
$EnumProc = $ID + "|" + $EnumProc
Next
$EnumProc = Left($EnumProc,Len($EnumProc)-1)
$GetObject = ''
EndFunction




of course you'll probably want to add some more error checking in there but that's at least how i'd structure the nuts and bolts. gurus, please make sure i'm not telling this man's car-computers directions to McDonalds. =P

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 580 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.072 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org