ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


3 posters

    Date.......

    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    Date....... Empty Date.......

    ตั้งหัวข้อ by Monaliza 15/10/10, 09:58 pm

    Test
    aut
    aut
    PSsix Powerful Scripting Class
    PSsix Powerful Scripting Class


    PSsix Game Coder
    จำนวนข้อความ : 472
    ความนิยม : 126
    เข้าร่วมเมื่อ : 24/07/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by aut 16/10/10, 08:44 am

    test
    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by Monaliza 16/10/10, 09:48 am

    ถ้าต้องการให้คำสั่งในโปรแกรมทำงานเมื่อ date and time ถูกต้องตามเงื่อนไขต้องใช้คำสั่งไหน
    เช่น
    Whire 1
    sleep(1000)
    $mo=xxxxx
    If xxxx$ then
    MsgBox(0,"chanking","time-pass","10)
    Esle
    DO
    ProcessClose("iexplore.exe")
    Until precessExists("iexplore.exe")
    EndIf
    regwriht"hkcu...............................run xxxxxxx
    sleep(10000)
    WEnd
    คือต้องการทำโปรแกรมตรวจสอบการใช้คอมพิวเตอร์ถ้ายังไม่ถึงเวลาที่กำหนดจะใช้คอมไม่ได้
    ต้องใช้คำสั่งไหน คำสั่งเกี่ยวกับ time and date ในautoitมีเยอะมากดูใน halp ก็ไม่เก่ง
    อังกฤษ รบกวน เทพ ๆทั้งหลายหน่อยนะครับ





    aut
    aut
    PSsix Powerful Scripting Class
    PSsix Powerful Scripting Class


    PSsix Game Coder
    จำนวนข้อความ : 472
    ความนิยม : 126
    เข้าร่วมเมื่อ : 24/07/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by aut 16/10/10, 01:41 pm

    นี่คับ อันนี้ถ้าไม่ใช่เวลาบ่ายโมงก็จะปิดเครื่อง ถ้าใช่ก็จะทำงานตามคำสั่ง เอาใส่ตรง startup จะได้เช็คทุกครั้งที่เปิดเครื่อง

    While 1
    If @HOUR =13 Then
    MsgBox(0,"xxx","เปิดได้เฉพาะบ่ายโมง")

    เอาคำสั่งที่จะให้ทำงานตอนบ่ายโมงใส่ตรงนี้

    else
    Shutdown(5)
    EndIf
    Sleep ( 1000 )
    WEnd
    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by Monaliza 17/10/10, 01:32 pm

    ถ้าจะตรวจหลายๆเวลาเช่น 9.30 แล้วก็12.00แล้วก็15.00ต้องใช้คำสั่ง If-then-elseIf-then-elseIf-then-else-EndIf ถูกไม่ครับ คำสั่งตั้งเวลา Log off ทุก15นาทีต้องเขียนยังไงครับ ถ้าปิดเครื่องเลยมันโหดไปshutdown(5)
    aut
    aut
    PSsix Powerful Scripting Class
    PSsix Powerful Scripting Class


    PSsix Game Coder
    จำนวนข้อความ : 472
    ความนิยม : 126
    เข้าร่วมเมื่อ : 24/07/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by aut 17/10/10, 04:05 pm

    ก็ใช้ Or ต่อเข้าไปอย่างนี้อะ บ่ายโมง กับ สี่โมง จะ logoff จะเอาอีกก็ใส่ Or ต่อๆ ไปอีก

    While 1
    If @HOUR =13 Or @HOUR =16 Then
    Shutdown(0)

    EndIf
    Sleep ( 1000 )
    WEnd
    rolovely
    rolovely
    PSsix Member Super Class II
    PSsix Member Super Class II


    PSsix Game Coder
    จำนวนข้อความ : 193
    ความนิยม : 26
    เข้าร่วมเมื่อ : 15/10/2010
    อายุ : 35
    ที่อยู่ : THAILAND

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by rolovely 17/10/10, 04:19 pm

    or หรือ and ก็ได้นะครับ
    aut
    aut
    PSsix Powerful Scripting Class
    PSsix Powerful Scripting Class


    PSsix Game Coder
    จำนวนข้อความ : 472
    ความนิยม : 126
    เข้าร่วมเมื่อ : 24/07/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by aut 17/10/10, 04:35 pm

    ใส่ and มันก็ไม่ทำงานอะดิ

    ถ้าใช้ได้เหมือนกัน จะมี and และ or สองอย่างไว้ทำไมอะ
    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by Monaliza 18/10/10, 06:10 am

    ขอบคุณครับที่ให้คำแนะนำ
    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by Monaliza 18/10/10, 09:19 pm

    แล้วถ้าต้องการให้ทำงานทุกวันอังคารกับทุกวันที่1ของเดือนล่ะครับ
    rolovely
    rolovely
    PSsix Member Super Class II
    PSsix Member Super Class II


    PSsix Game Coder
    จำนวนข้อความ : 193
    ความนิยม : 26
    เข้าร่วมเมื่อ : 15/10/2010
    อายุ : 35
    ที่อยู่ : THAILAND

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by rolovely 19/10/10, 02:38 am

    ลองเอาไปประยุกต์เองนะครับ

    Code:
    #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <Timers.au3>
    #include <GuiStatusBar.au3>
    #include <ProgressConstants.au3>

    Opt("MustDeclareVars", 1)

    Global $iMemo, $hStatusBar, $progress, $percent = 0, $direction = 1

    _Example_CallBack()

    Func _Example_CallBack()
        Local $hGUI, $iTimerProgress, $btn_change, $iWait = 10, $btn_state
        Local $aParts[3] = [75, 330, -1]

        $hGUI = GUICreate("Timers Using CallBack Function(s)", 400, 320)
        $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
        GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
        $btn_state = GUICtrlCreateButton("Start Progress Bar", 70, 270, 100, 25)
        $btn_change = GUICtrlCreateButton("Change", 215, 270, 90, 25)
        GUICtrlSetState($btn_change, $GUI_DISABLE)
        $hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aParts)
        _GUICtrlStatusBar_SetText($hStatusBar, "Timers")
        _GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        GUICtrlSetColor($progress, 0xff0000)
        _GUICtrlStatusBar_EmbedControl($hStatusBar, 1, GUICtrlGetHandle($progress))
        GUISetState()

        _Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock") ; create timer

        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $btn_state
                    If GUICtrlRead($btn_state) = "Start Progress Bar" Then
                        $iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "_UpdateProgressBar") ; create timer
                        If @error Or $iTimerProgress = 0 Then ContinueLoop
                        GUICtrlSetData($btn_state, "Stop Progress Bar")
                        GUICtrlSetState($btn_change, $GUI_ENABLE)
                    Else
                        GUICtrlSetState($btn_change, $GUI_DISABLE)
                        _Timer_KillTimer($hGUI, $iTimerProgress)
                        GUICtrlSetData($btn_state, "Start Progress Bar")
                    EndIf

                Case $btn_change
                    If $iWait = 10 Then
                        $iWait = 250
                    Else
                        $iWait = 10
                    EndIf
                    MemoWrite("Timer for _UpdateProgressBar set at: " & $iWait & " milliseconds")
                    $iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "", $iTimerProgress) ; reuse timer with different interval
            EndSwitch
        WEnd
        ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF)
        GUIDelete()
    EndFunc  ;==>_Example_CallBack

    ; call back function
    Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime)
        #forceref $hWnd, $Msg, $iIDTimer, $dwTime
        _GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
    EndFunc  ;==>_UpdateStatusBarClock

    ; call back function
    Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime)
        #forceref $hWnd, $Msg, $iIDTimer, $dwTime
        $percent += 5 * $direction
        GUICtrlSetData($progress, $percent)
        If $percent = 100 Or $percent = 0 Then $direction *= -1
        If $percent = 100 Then
            GUICtrlSetColor($progress, 0xff0000)
        ElseIf $percent = 0 Then
            GUICtrlSetColor($progress, 0x0000ff)
        EndIf
    EndFunc  ;==>_UpdateProgressBar

    ; Write a line to the memo control
    Func MemoWrite($sMessage)
        GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
    EndFunc  ;==>MemoWrite
    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    Date....... Empty Re: Date.......

    ตั้งหัวข้อ by Monaliza 19/10/10, 09:44 am

    ทำได้แล้วครับขอบคุณมาก :(

      เวลาขณะนี้ 19/04/24, 10:37 pm