#178037 - 2007-07-18 08:32 AM
Re: How Many Members
[Re: Shawn]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
Silence of the lamps
|
Top
|
|
|
|
#178045 - 2007-07-18 03:10 PM
Re: How Many Members
[Re: Mart]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
This is the script that I used to use when I had failed lightbulb issues.
Feel free to update and post as a UDF if you think it would be generally useful.
Break ON
$=SetOption("Explicit","ON")
; ChangeLamp.kix
; Automated lightbulb changer
Dim $sLampRef, $oLamp, $oNewLamp, $oSwitch, $iLampState
"Please enter lightbulb maintenance reference: " GetS $sLampRef
$oLamp=GetObject("Lamp:/"+$sLampRef)
$oSwitch=GetObject("Switch:/"+$sLampRef)
$iLampState=$oLamp.Illuminated
$oSwitch.Toggle
$iLampState=$oLampState | $oLamp.Illuminated
$oSwitch.Toggle
If $iLampState
Select
Case $oLamp.Type="Bayonet"
$oLamp.Push
$oLamp.Rotate(-90)
$oLamp.Pull
:GetNewLampBayonet
$oNewLamp=CreateObject("Lamp.Bayonet")
$oNewLamp.Push
If $oNewLamp.IsHot
$oSwitch.Toggle
$=RunFingersUnderColdWater(@WKSTA)
If $oNewLamp.Broken Goto "GetNewLampBayonet" EndIf
EndIf
$oLamp.Rotate(90)
Case $oLamp.Type="Edison Screw"
While Not $oLamp.Released
$oLamp.Rotate(-180)
Loop
:GetNewLampScrew
$oNewLamp=CreateObject("Lamp.Screw")
While $oNewLamp.Loose
$oNewLamp.Rotate(180)
If $oNewLamp.IsHot
$oSwitch.Toggle
$=RunFingersUnderColdWater(@WKSTA)
If $oNewLamp.Broken Goto "GetNewLampScrew" EndIf
EndIf
Loop
EndSelect
$iLampState=$oLamp.Illuminated
$oSwitch.Toggle
$iLampState=$oLampState | $oLamp.Illuminated
$oSwitch.Toggle
If $iLampState
"Lamp successfully changed and tested"+@CRLF
Else
"Lamp still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
EndIf
Else
"Lamp is OK, no need to change"+@CRLF
EndIf
|
Top
|
|
|
|
#178046 - 2007-07-18 03:18 PM
Re: How Many Members
[Re: Richard H.]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Now, I think all we are missing is to Golf that down
|
Top
|
|
|
|
#178048 - 2007-07-18 03:27 PM
Re: How Many Members
[Re: Mart]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
here is a start:
; ChangeLamp.kix
; Automated lightbulb changer
Dim $R, $O, $N, $S, $I
"Please enter lightbulb maintenance reference: " Gets $R
$O=GetObject("Lamp:/"+$R)
$S=GetObject("Switch:/"+$R)
$I=$O.Illuminated
$S.Toggle
$I=$OState | $O.Illuminated
$S.Toggle
If $I
If $O.Type="Bayonet"
$O.Push
$O.Rotate(-90)
$O.Pull
:GetNewLampBayonet
$N=CreateObject("Lamp.Bayonet")
$N.Push
If $N.IsHot
$S.Toggle
$=RunFingersUnderColdWater(@WKSTA)
If $N.Broken Goto "GetNewLampBayonet" EndIf
EndIf
$O.Rotate(90)
Else ;$O.Type="Edison Screw"
While Not $O.Released
$O.Rotate(-180)
Loop
:GetNewLampScrew
$N=CreateObject("Lamp.Screw")
While $N.Loose
$N.Rotate(180)
If $N.IsHot
$S.Toggle
$=RunFingersUnderColdWater(@WKSTA)
If $N.Broken Goto "GetNewLampScrew" EndIf
EndIf
Loop
EndIf
$I=$O.Illuminated
$S.Toggle
$I=$OState | $O.Illuminated
$S.Toggle
If $I
"Lamp successfully changed and tested"+@CRLF
Else
"Lamp still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
EndIf
Else
"Lamp is OK, no need to change"+@CRLF
EndIf
|
Top
|
|
|
|
#178055 - 2007-07-18 08:53 PM
Re: How Many Members
[Re: Lonkero]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Doh! 5 less
; ChangeLamp.kix
; Automated lightbulb changer
Dim $R, $O, $N, $S, $I
"Please enter lightbulb maintenance reference: " Gets $R
$O=GetObject("Lamp:/"+$R)
$S=GetObject("Switch:/"+$R)
$S.Toggle
$I=$OState | $O.Illuminated
$S.Toggle
If $I
If $O.Type="Bayonet"
$O.Push
$O.Rotate(-90)
$O.Pull
:GetNewLampBayonet
$N=CreateObject("Lamp.Bayonet")
$N.Push
If $N.IsHot
$S.Toggle
$=RunFingersUnderColdWater(@WKSTA)
If $N.Broken Goto "GetNewLampBayonet" EndIf
EndIf
$O.Rotate(90)
Else ;$O.Type="Edison Screw"
While Not $O.Released
$O.Rotate(-180)
Loop
:GetNewLampScrew
$N=CreateObject("Lamp.Screw")
While $N.Loose
$N.Rotate(180)
If $N.IsHot
$S.Toggle
$=RunFingersUnderColdWater(@WKSTA)
If $N.Broken Goto "GetNewLampScrew" EndIf
EndIf
Loop
EndIf
$S.Toggle
$I=$OState | $O.Illuminated
$S.Toggle
If $I
"Lamp successfully changed and tested"+@CRLF
Else
"Lamp still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
EndIf
Else
"Lamp is OK, no need to change"+@CRLF
;EndIf
|
Top
|
|
|
|
#178057 - 2007-07-18 09:36 PM
Re: How Many Members
[Re: Lonkero]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Dang! I think your right Jooel, now i gota rework this.
|
Top
|
|
|
|
#178060 - 2007-07-18 11:38 PM
Re: How Many Members
[Re: Lonkero]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
I think richie only had a typo in his original code.
True, I didn't spot that one - that's what happens if you don't test properly.
There is also a logic error that I introduced to see if anyone was paying attention
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 918 anonymous users online.
|
|
|