home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
In'side Shareware 1995 April
/
ish0495.iso
/
win95
/
winbatch
/
kidproof.wb_
< prev
next >
Wrap
Text File
|
1994-09-15
|
5KB
|
179 lines
a1="Lets you load some programs that kids want to play with, and then by "
a2="running this script, it will hide ProgMan and any iconized programs. "
a3="When all initial windows have been closed, you will be prompted for a "
a4="password to continue. When the correct password is entered, the "
a5="iconized windows will come back. PS. The password for now is TINCAN"
a6=strcat(a1,a2,a3,a4,a5)
Message("KidProof",a6)
drop(a1,a2,a3,a4,a5,a6)
;<-----------------------snip-------------------------------------------->
;Are we already running?
if WinState("Program Manager")==@HIDDEN
Display(5,"Hmmm","KidProof already running"
exit
endif
PswdMsg="Password is tincan" ; <<<<<<<<<<<<<<<<Edit this line
Password="tincan" ; <<<<<<<<<<<<<<<<Edit this line too
;Stay Running!!! This function required batch file to have normal exit
IntControl(12,10,"Close all programs before shutting down Windows",0,0)
; Now we get busy
;Get currently installed taskmanager
;debug(1)
OrigTask=IniReadPvt("boot","taskman.exe","taskman.exe","system.ini")
OrigTask=FileLocate(OrigTask)
if OrigTask=="" ; Initiate disaster recovery (Kid pressed reset button, etc)
Display(3,"Disaster Recovery","In Progress")
OrigTask=IniReadPvt("KIDTOY","Origtm",strcat(DirWindows(0),"taskman.exe"),"WWW-PROD.INI" )
CopyTask2=IniReadPvt("KIDTOY","backuptm",strcat(DirWindows(0),"taskman.cp2"),"WWW-PROD.INI" )
if !FileExist(CopyTask2)
Message("Disaster Recovery","Task Manager missing. Best Wishes")
exit
endif
FileCopy(CopyTask2,OrigTask,0)
Display(3,"Disaster Recovery","Complete")
endif
ppp=FilePath(OrigTask) ; Parse out file names
rrr=FileRoot(OrigTask)
eee=FileExtension(OrigTask)
CopyTask=strcat(ppp,rrr,".CPY") ; Build working file name
CopyTask2=strcat(ppp,rrr,".CP2") ; Build disaster recovery file name
if !FileExist(CopyTask2) ; Save info for future disasters
FileCopy(OrigTask,CopyTask2,0) ; Permanent backup for future disaster recovery
IniWritePvt("KIDTOY","Origtm",OrigTask,"WWW-PROD.INI")
IniWritePvt("KIDTOY","backuptm",CopyTask2,"WWW-PROD.INI")
endif
; Remove task manager
if FileExist(OrigTask)
FileMove(OrigTask,CopyTask,0)
endif
;Following code helps in debug
;ErrorMode(@off)
;WinTitle("Program Manager","")
;ErrorMode(@cancel)
;Iconize Progman and File manager (comment out for debug )
ErrorMode(@off)
WinIconize("Program Manager")
WinIconize("File manager")
ErrorMode(@CANCEL)
;Grab current Windows and hide iconized ones.
gosub SetupSplash
while @TRUE
Delay(2) ; Don't suck up all system resources continiously
a=WinGetActive() ; Any active Windows ???
if a == "" then break ; No? We are done
endwhile
:CANCEL
while @TRUE
; Get authorization
pswd=AskPassword(PswdMsg,"Enter Password")
password=strlower(password)
pswd=strlower(pswd)
if pswd==password then break
Display(5,"Ooopsie","Bad Password")
endwhile
;Bring back Windows
gosub UnSplash
;Restore Taskmanager
;debug(1)
FileMove(CopyTask,OrigTask,0)
exit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SetupSplash hides all iconic windows, remembers winstate
:setupsplash
OrigWindowList=WinItemize() ;Get list of all open Windows
OrigWindowCount=ItemCount(OrigWindowList,@tab)
for i=1 to OrigWindowCount
a=ItemExtract(i,OrigWindowList,@tab)
b = WinState(a)
OrigWindowState%i% = b
; Note we could hide the other windows here, but if the install
; bombs kind of bad, it leaves the user in a lurch and they
; got to reboot. Bad news. With icons they can always recover
; by themselves.
if b==@ICON then WinHide(a)
next
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;UnSplash undoes Setup Splash
:UnSplash
ErrorMode(@off)
for i= OrigWindowCount to 1 by -1
a=ItemExtract(i,OrigWindowList,@tab)
;Display(3,"Window",a)
switch OrigWindowState%i%
case @HIDDEN
break
case @NORMAL
WinShow(a)
break
case @ICON
WinShow(a)
break
case @ZOOMED
WinZoom(a)
break
end switch
next
ErrorMode(@cancel)
return;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;