Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Misc.au3>
- #include <Constants.au3>
- #include <MsgBoxConstants.au3>
- #include <WinAPI.au3>
- #include <Array.au3>
- #include <GUIConstants.au3>
- Global $LaserOff = 438782087
- Global $LaserOn = 2402470436
- Global $mousePos = MouseGetPos()
- Global $mouseX = $mousePos[0]
- Global $mouseY = $mousePos[1]
- Global $Value = 0
- Global $WTValue = 0
- Global $FTValue = 0
- Global $WTValueSec = 0
- Global $FTValueSec = 0
- Global $SliderValue = 0
- Global $sWTimer = 0
- Global $sFTimer = 0
- Local $hGUI = GUICreate("Длинный рез",350,150)
- GUICtrlCreateLabel("Для долгого реза с частым перегревом сопла.", 10,10,300,20)
- $Start= GUICtrlCreateButton("Start",10,110,90,30)
- $SliderWT = GUICtrlCreateSlider(10,40,150,20)
- GUICtrlSetLimit($SliderWT,6,1)
- $SliderFT = GUICtrlCreateSlider(10,70,150,20)
- GUICtrlSetLimit($SliderFT,10,1)
- Global $sWorkTime = "Work time: "
- Global $sFlexTime = "Flex time: "
- Global $sWaitTime = "Wait time: "
- $LableWT = GUICtrlCreateLabel($sWorkTime,170,40,100,20)
- $LableFT = GUICtrlCreateLabel($sFlexTime,170,70,100,20)
- Global $WTimerLabel = GUICtrlCreateLabel($sWTimer,280,40,100,20)
- Global $FTimerLabel = GUICtrlCreateLabel($sFTimer,280,70,100,20)
- Global $WaitTimeLabel = GUICtrlCreateLabel($sWaitTime,210,100,100,20)
- ;------------------------------------------------------------------------------------
- ;Push Start Button
- ;------------------------------------------------------------------------------------
- Func PushStart()
- WinActivate ("[CLASS:TfrmCypCut]","")
- $mousePos = MouseGetPos()
- $mouseX = $mousePos[0]
- $mouseY = $mousePos[1]
- MouseClick("left", 1059,481 ,1,1)
- MouseMove($mouseX,$mouseY,1)
- EndFunc
- ;------------------------------------------------------------------------------------
- ;Push Pause Button
- ;------------------------------------------------------------------------------------
- Func PushPause()
- WinActivate ("[CLASS:TfrmCypCut]","")
- $mousePos = MouseGetPos()
- $mouseX = $mousePos[0]
- $mouseY = $mousePos[1]
- MouseClick("left", 70,85 ,1,1)
- MouseMove($mouseX,$mouseY,1)
- EndFunc
- ;------------------------------------------------------------------------------------
- ; Push Resume Button
- ;------------------------------------------------------------------------------------
- Func PushResume()
- WinActivate ("[CLASS:TfrmCypCut]","")
- $mousePos = MouseGetPos()
- $mouseX = $mousePos[0]
- $mouseY = $mousePos[1]
- MouseClick("left", 122,85 ,1,1)
- MouseMove($mouseX,$mouseY,1)
- EndFunc
- ;------------------------------------------------------------------------------------
- Func ReadSliderWT()
- $Value = GUICtrlRead($SliderWT,$GUI_READ_EXTENDED)
- $SliderValue = $Value * 5
- Return $SliderValue
- EndFunc
- ;------------------------------------------------------------------------------------
- Func ReadSliderFT()
- $Value = GUICtrlRead($SliderFT,$GUI_READ_EXTENDED)
- Return $Value
- EndFunc
- ;------------------------------------------------------------------------------------
- Func DeleteLabels()
- GUICtrlDelete($WTimerLabel)
- GUICtrlDelete($FTimerLabel)
- GUICtrlDelete($WaitTimeLabel)
- EndFunc
- ;------------------------------------------------------------------------------------
- Func UpDateLabels($WTimer,$FTimer,$WaitTime,$WorkTime,$FlexTime,$WaitTimeSec)
- $sWTimer = $WTimer& " sec./"&$WorkTime& " sec."
- $sFTimer = $FTimer& " sec./"&$FlexTime& " sec."
- $sWaitTime = "Wait time: "&$WaitTime& " sec./"&$WaitTimeSec& " sec."
- $WTimerLabel = GUICtrlCreateLabel($sWTimer,257,40,100,20)
- $FTimerLabel = GUICtrlCreateLabel($sFTimer,257,70,100,20)
- $WaitTimeLabel = GUICtrlCreateLabel($sWaitTime,207,100,140,20)
- EndFunc
- ;------------------------------------------------------------------------------------
- Func ESC()
- EndFunc
- ;------------------------------------------------------------------------------------
- Func StartProcess($WorkTime,$FlexTime,$WaitTimeSec)
- WinActivate ("[CLASS:TfrmCypCut]","")
- $WTimer = 0
- $FTimer = 0
- $WaitTime = 0
- While 1
- Sleep(500)
- If _IsPressed("1B") Then
- ExitLoop
- EndIf
- $LaserCheck = PixelChecksum(1187,386,1260,408)
- If $LaserCheck = $LaserOff AND $WTimer = 0 Then
- PushStart()
- $WTimer = $WTimer + 0.5
- ElseIf $LaserCheck = $LaserOn Then
- $WTimer = $WTimer + 0.5
- EndIf
- If $LaserCheck = $LaserOff AND $FTimer = 0 AND $WTimer>=$WorkTime Then
- PushPause()
- $FTimer = $FTimer + 0.5
- ElseIf $FTimer<=$FlexTime AND $LaserCheck = $LaserOff AND $WTimer>=$WorkTime Then
- $FTimer = $FTimer + 0.5
- ElseIf $FTimer>$FlexTime Then
- PushResume()
- $WTimer = 0.5
- $FTimer = 0
- EndIf
- If $LaserCheck = $LaserOn Then
- $WaitTime = 0
- EndIf
- If $LaserCheck = $LaserOff Then
- $WaitTime = $WaitTime + 0.5
- EndIf
- If $WaitTime > $WaitTimeSec Then
- ExitLoop
- EndIf
- DeleteLabels()
- UpDateLabels($WTimer,$FTimer,$WaitTime,$WorkTime,$FlexTime,$WaitTimeSec)
- WEnd
- EndFunc
- ;------------------------------------------------------------------------------------
- Func SliderRead()
- Local $aValueArr[3] = [0,0,0]
- $WTValue = ReadSliderWT()
- ;MsgBox("","",$WTValue)
- $sWorkTime = "Work time "&$WTValue&" min."
- GUICtrlSetData($LableWT,$sWorkTime)
- $FTValue = ReadSliderFT()
- ;MsgBox("","",$WTValue)
- $sFlexTime = "Flex time "&$FTValue&" min."
- GUICtrlSetData($LableFT,$sFlexTime)
- $WTValueSec = $WTValue * 60
- $FTValueSec = $FTValue * 60
- $WaitTimeSec = $FTValueSec+10
- $aValueArr[0] = $WTValueSec
- $aValueArr[1] = $FTValueSec
- $aValueArr[2] = $WaitTimeSec
- Return $aValueArr
- EndFunc
- ;------------------------------------------------------------------------------------
- ;Programm
- ;------------------------------------------------------------------------------------
- GUISetState(@SW_SHOW,$hGUI)
- Sleep(5)
- WinMove("Длинный рез","", 914,500 )
- Sleep(5)
- WinSetOnTop("Длинный рез","",1)
- Local $aArr[3] = [0,0,0]
- While 1
- Sleep(100)
- $aArr = SliderRead()
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE
- ExitLoop
- Case $Start
- StartProcess($aArr[0],$aArr[1],$aArr[2])
- EndSwitch
- WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement