Page 2 of 2 <12
Topic Options
#57422 - 2001-07-23 11:19 PM Re: run program silently through logon script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Check to typing between the quotes. Is it the same as what appears on the titlebar of the window? What is the modality of the window? Can you Alt-Tab to it? If you can't, then you probably can't use setfocus () to test for it's presence. You may need to rely on a long enough sleep time to ensure the dialog is there and sendkeys() to the parent window.

If all else fails, you may have to enlist the users to do the right thing. Use messagebox() to put up instructions and hope they can read and follow them.

Maybe if someone else is following this post they may have a better idea.

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

Top
#57423 - 2001-07-24 12:05 AM Re: run program silently through logon script
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
jvd626,

To make sure that your script waits for the windows to get focus, use Do-Until, you should use something like this:

code:
Do
Sleep 1
Until SetFocus("Telephony LAN-Linx Config") = 0
SendKeys("~o")
Do
Sleep 1
Until SetFocus("Lan-Linx 2000 Installation") = 0
SendKeys("{ENTER}")

This should do the same job as your last script, but you don't have to guess how long to sleep!

-Erik

Top
#57424 - 2001-07-24 02:32 AM Re: run program silently through logon script
Anonymous
Unregistered


Awesome! That worked like a charm, thanks erik! Though this script is bullet-proof on NT/2000, it doesn't run quite well on 9X machines LL, I went ahead and used the registry check for uninstall with if and end statement.

I'm not sure why it stops when running on 9X in the middle of the script, probably because its on the wrong sleep timing? It doesn't seem to pass beyond the copying process of the install. Probably create a second script for 9X instead ...Can someone point to me how this should be done on 9X?

Here is the code:

code:

; check if already installed
$Linxuninstall = ReadValue("HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\uninstall\Lan-LinX 2000", "uninstallstring")
if $Linxuninstall = ""
$RC = MessageBox("Your Lan-LinX Phone software will be upgraded." + Chr(13) + "Please be patient while software Installs.","Lan-LinX Phone Software Install",64,60)
run( "\\server1\netlogon\setup.exe" )
Sleep ( 2 )
SetFocus( "Lan-LinX 2000 Installation" )
SendKeys("{ENTER}")
Sleep ( 1 )
SetFocus( "Type of Installation" )
SendKeys("{DOWN 3}")
SendKeys("{ENTER}")
Sleep ( 1 )
SetFocus( "Lan-Linx 2000 Installation" )
SendKeys("{ENTER 4}")
Do
Sleep 1
Until SetFocus( "Installing" )
Do
Sleep 1
Until SetFocus("Telephony LAN-Linx Config") = 0
SendKeys("~o")
Do
Sleep 1
Until SetFocus("Lan-Linx 2000 Installation") = 0
SendKeys("{ENTER}")
endif

Also, I was wondering if its possible to run two kix scripts on a batch file at the same time? The reason why I'm asking this is because I want to add a second (separate) kix script that basically runs drive mappings, then runs the software installation.

Top
#57425 - 2001-07-24 03:58 PM Re: run program silently through logon script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Erik,
Isn't...
Do
Sleep 1
Until SetFocus("Telephony LAN-Linx Config") = 0

the same as?
While
$RC = SetFocus("Untitled - Notepad") <> 0
Sleep (1)
Loop

JVD,
You probaably will need to write separate code for W95. Have you tried running it with debug on? That way you can single-step and dump variables to try and get a handle on what is happening.
I'm trying to grasp your last question. Are you wanting to run two instances of Kix at one time, one for the usual logon (mapping etc.) and the other for maintenance(installs etc.)? As far as I know they need to run in sequence. Here's a excerpt from my logon bat file:

code:

:KIX_W95_LOCAL
%windir%\KIX32.EXE %0\..\NAV.KIX
%windir%\KIX32.EXE %0\..\MDM.KIX
%windir%\KIX32.EXE %0\..\SC3.KIX
%windir%\KIX32.EXE %0\..\O301120.kix
GOTO END

:KIX_NT_LOCAL
%0\..\KIX32.EXE %0\..\NAV.KIX
%0\..\KIX32.EXE %0\..\SC3.KIX
%0\..\KIX32.EXE %0\..\O301120.kix
GOTO END

:END

EXIT


I know I should combine all the scripts into one with only one call to cut down on the number of times that Kix gets loaded but I just haven't gotten around to it. Also, I don't have much code as my main logon script is on my NetWare server.

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

Top
#57426 - 2001-07-24 04:17 PM Re: run program silently through logon script
Anonymous
Unregistered


Yah LL, just like that, multiple instances of script running in batch. Also, I might have not done it correctly when doing a "while - loop" but the "Until - Do" worked great for me and am using that on windows 9X. I already am continuing to redo a separate script for windows 9X and its getting there, it has more stuff that needs input! I'm just following all you people's advice to point me in the right direction. What will I do without you guys

I'll let you know when I finish the windows 9X script and post it here.

Top
#57427 - 2001-07-25 07:30 PM Re: run program silently through logon script
Anonymous
Unregistered


hi everyone, I tried modifying the script a little and putting a log file so that it puts it on a centralized location. In this case, I can keep track of who installed the program according to the flag. I setup "authenticated users" to have modify permission on the file.

The problem: It doesn't stop installing the program somehow..here is the code:

quote:

$linxfile="\\server1\netlogon\lanlinx.ini"
$info=ReadProfileString($linxfile,"install",@userid)
IF exist($info) = 0
$RC = MessageBox("Your Lan-LynX Phone software will be upgraded." + Chr(13) + "Please be patient while software Installs.","Lan-LinX Phone Software Install/Upgrade",64,60)
run( "\\server1\netlogon\setup.exe" )
Sleep ( 5 )
SetFocus( "Lan-LinX 2000 Installation" ) = 0
SendKeys("{ENTER}")
Do
Sleep 1
Until SetFocus( "Type of Installation" ) = 0
SendKeys("{DOWN 3}")
SendKeys("{ENTER}")
Sleep ( 1 )
SetFocus( "Lan-Linx 2000 Installation" ) = 0
SendKeys("{ENTER 4}")
Do
Sleep 1
Until SetFocus( "Installing" ) = 0
Do
Sleep 1
Until SetFocus("Telephony LAN-Linx Config") = 0
SendKeys("~o")
Do
Sleep 1
Until SetFocus("Lan-Linx 2000 Installation") = 0
SendKeys("{ENTER}")
IF (WriteProfileString($linxfile,"install",@userid,@date+" "+@time) <> 0)
ENDIF
ELSE
$info=ReadProfileString($linxfile,"install",@userid)
? "Informative INSTALL: software already installed at "+$info
endif

Thanks alot. -jImmy

Top
#57428 - 2001-07-28 01:21 AM Re: run program silently through logon script
Anonymous
Unregistered


Hi there,

Maybe the runonce-key is an option ?

Hai Kir@,

Maybe a little too late since you're on vacation, but you can use the RUNONCE-key instead of using SHELL or RUN.

For example:

code:

$troep=WriteValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Runonce","Superdat","C:\superdat.exe","REG_SZ")

Windows will wait patiently with booting after this installation has ended. It works great with msi-installs as t0a5t mentioned before.

Also take a look at this thread for automated remote installations:

automatedinstall

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.056 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