ผมทปรกรมตั้งเวลปิดคอม
4 posters
โปรกรมตั้งเวลปิดเครื่ง
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°1
โปรกรมตั้งเวลปิดเครื่ง
POS- PSsix
-
จำนวนข้อความ : 1152
ความนิยม : 326
เข้าร่วมเมื่อ : 19/07/2010
- Post n°2
Re: โปรกรมตั้งเวลปิดเครื่ง
ต้องเอาโค้ดที่มีปัญหาลงมาดูครับ
แล้วข้อความคำถามก็ขาดๆ หายๆ เหมือนในรูปด้านล่างนี้ด้วย น่าจะเป็นที่ตัวเบราเซอร์
แล้วข้อความคำถามก็ขาดๆ หายๆ เหมือนในรูปด้านล่างนี้ด้วย น่าจะเป็นที่ตัวเบราเซอร์
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°3
Re: โปรกรมตั้งเวลปิดเครื่ง
#include <GUIConstants.au3>
#include <Date.au3>
$Form1 = GUICreate("Shutdown Windows", 319, 160, 193, 127)
$Label1 = GUICtrlCreateLabel("Time Shutdown", 8, 8, 78, 17)
$Input1 = GUICtrlCreateInput("", 8, 32, 121, 21)
$Button1 = GUICtrlCreateButton("Ok", 232, 16, 75, 25)
$Button2 = GUICtrlCreateButton("Reset", 232, 56, 75, 25)
$Button3 = GUICtrlCreateButton("Exit", 232, 96, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 8, 64, 217, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$timex = GUICtrlRead($Input1)
If $timex <> "" Then
GUICtrlSetData($Edit1,"time shutdown = "&$timex)
If _NowTime(4) = $timex Then
Shutdown(1)
Else
sleep(100)
EndIf
Else
MsgBox(0,"test","Time To shutdown")
ExitLoop
EndIf
Case $Button2
$timex = ""
GUICtrlSetData($Input1,"")
GUICtrlSetData($Edit1,"")
Case $Button3
Exit
EndSwitch
WEnd
มันตรวจแค่รอบเดียวพอผมเพิ่ม loop ซ่อนloop มันไม่ยอมปิดอีก
ตอนทำแบบใช้Inputboxก็ทำงานได้ปรกติ แต่พอมาทำแบบ GUI มันไม่ยอมทำงานครับ
ผมยังเขียนแบบ GUI ยังไม่ค่อยเป็นครับ
#include <Date.au3>
$Form1 = GUICreate("Shutdown Windows", 319, 160, 193, 127)
$Label1 = GUICtrlCreateLabel("Time Shutdown", 8, 8, 78, 17)
$Input1 = GUICtrlCreateInput("", 8, 32, 121, 21)
$Button1 = GUICtrlCreateButton("Ok", 232, 16, 75, 25)
$Button2 = GUICtrlCreateButton("Reset", 232, 56, 75, 25)
$Button3 = GUICtrlCreateButton("Exit", 232, 96, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 8, 64, 217, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$timex = GUICtrlRead($Input1)
If $timex <> "" Then
GUICtrlSetData($Edit1,"time shutdown = "&$timex)
If _NowTime(4) = $timex Then
Shutdown(1)
Else
sleep(100)
EndIf
Else
MsgBox(0,"test","Time To shutdown")
ExitLoop
EndIf
Case $Button2
$timex = ""
GUICtrlSetData($Input1,"")
GUICtrlSetData($Edit1,"")
Case $Button3
Exit
EndSwitch
WEnd
มันตรวจแค่รอบเดียวพอผมเพิ่ม loop ซ่อนloop มันไม่ยอมปิดอีก
ตอนทำแบบใช้Inputboxก็ทำงานได้ปรกติ แต่พอมาทำแบบ GUI มันไม่ยอมทำงานครับ
ผมยังเขียนแบบ GUI ยังไม่ค่อยเป็นครับ
POS- PSsix
-
จำนวนข้อความ : 1152
ความนิยม : 326
เข้าร่วมเมื่อ : 19/07/2010
- Post n°4
Re: โปรกรมตั้งเวลปิดเครื่ง
- Code:
#include <GUIConstants.au3>
#include <Date.au3>
AdlibRegister ("Stime",1000)
$Form1 = GUICreate("Shutdown Windows", 319, 160, 193, 127)
$Label1 = GUICtrlCreateLabel("Time Shutdown", 8, 8, 78, 17)
$Input1 = GUICtrlCreateInput("", 8, 32, 121, 21)
$Button1 = GUICtrlCreateButton("Ok", 232, 16, 75, 25)
$Button2 = GUICtrlCreateButton("Reset", 232, 56, 75, 25)
$Button3 = GUICtrlCreateButton("Exit", 232, 96, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 8, 64, 217, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$timex = GUICtrlRead($Input1)
If $timex <> "" Then
GUICtrlSetData($Edit1,"time shutdown = "&$timex)
;~ If _NowTime(4) = $timex Then
;~ Shutdown(1)
;~ Else
;~ sleep(100)
;~ EndIf
Else
MsgBox(0,"test","Time To shutdown")
ExitLoop
EndIf
Case $Button2
$timex = ""
GUICtrlSetData($Input1,"")
GUICtrlSetData($Edit1,"")
Case $Button3
Exit
EndSwitch
WEnd
Func Stime()
$timex = GUICtrlRead($Edit1)
if StringInStr($timex,_NowTime(4)) Then Shutdown(1)
EndFunc
โปรแกรมนี้ถ้าใช้คนเดียวไม่มีปัญหา แต่ถ้าให้คนอื่นเอาไปใช้ จะมีปัญหาเรื่องการตั้งเวลา ซึ่งต้องพิมพ์รูปแบบ 14:42 ถ้าพิมพ์เป็น 14.42 ก็จะไม่ทำงาน (วิธีแก้ไขก็ใช้พวก combobox ทำเวลาให้ผู้ใช้เลือกไปเลย) เช่น เลือกชั่วโมง
- Code:
$Combo1 = GUICtrlCreateCombo("Combo1", 88, 56, 97, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24")
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°5
Re: โปรกรมตั้งเวลปิดเครื่ง
AdlibRegisterคำสั่งนี้ใช้ทำไรครับขอบคุณครับ
POS- PSsix
-
จำนวนข้อความ : 1152
ความนิยม : 326
เข้าร่วมเมื่อ : 19/07/2010
- Post n°6
Re: โปรกรมตั้งเวลปิดเครื่ง
คำสั่งสำหรับกำหนดให้ทำงานฟังก์ชันที่กำหนด ตามระยะเวลาที่ระบุเอาไว้ (หน่วยเวลาเป็น MS)
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°7
Re: โปรกรมตั้งเวลปิดเครื่ง
ขอบคุณครับเดียวจะเอาไปปรับปรุงโครงสร้างใหม่+ปรับหน้าตาโปรแกรมให้ดีขึ้น
Func Stime()
$timex = GUICtrlRead($Edit1);ประกาศตัวแปร $timex
if StringInStr($timex,_NowTime(4)) Then Shutdown(1)
;เช็คว่า ตัวอักษรที่ได้จากตัวแปร $timex=ตัวอักษรที่ได้จากคำสั่ง_NowTime(4)ซึ้งก็คือเวลาปัจจุบันของ wondows ถ้าเงื่อนไขถูกต้อง ให้shutdown ผมเข้าใจถูกหรือครับ
EndFunc
Func Stime()
$timex = GUICtrlRead($Edit1);ประกาศตัวแปร $timex
if StringInStr($timex,_NowTime(4)) Then Shutdown(1)
;เช็คว่า ตัวอักษรที่ได้จากตัวแปร $timex=ตัวอักษรที่ได้จากคำสั่ง_NowTime(4)ซึ้งก็คือเวลาปัจจุบันของ wondows ถ้าเงื่อนไขถูกต้อง ให้shutdown ผมเข้าใจถูกหรือครับ
EndFunc
aut- PSsix Powerful Scripting Class
จำนวนข้อความ : 472
ความนิยม : 126
เข้าร่วมเมื่อ : 24/07/2010
- Post n°8
Re: โปรกรมตั้งเวลปิดเครื่ง
StringInStr มานใช้หาคำในตัวแปรหรือข้อความอะนาย tringInStr("หาคำในนี้", "ใส่ตัวรัยก้อได้ที่จะหาอะ")
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°9
Re: โปรกรมตั้งเวลปิดเครื่ง
ตรง Case $Button3
Exit
จากเดิมผมตั้งไว้ว่าถ้ากดปุ่มให้ออกโปรแกรม
ตอนนี้ลองเปลี่ยนเป็น ถ้ากดปุ่มให้ซ่อนหน้าต่างโปรแกรม
Case $Button3
GUISetState(@SW_HIDE,$From1)
แล้วทำ
hotkeyset("{ESC}","_SHOW1")
Func _SHOW1()
GUISetState(@SW_SHOW,$From1)
EndFunc
เมื่อกดปุ่ม ESC ให้โชว์หน้าต่างโปรแกรมเหมือนเดิม
ก็ใช้งานได้ไม่มีปัญหา
แต่ต้องเอา ตัว hotkeyset("{ESC}","_SHOW1") ไปวางใน loop
ถึงจะทำงานได้
อยากถามว่าการเอาhotkeyset("{ESC}","_SHOW1") ไปวางใน loop
จะมีปัญหาอะไรหรือเปล่าครับปรกติไม่ค่อยเห็นเขาทำกัน
เครื่องจะทำงานหนักไปหรือเปล่าครับ
Exit
จากเดิมผมตั้งไว้ว่าถ้ากดปุ่มให้ออกโปรแกรม
ตอนนี้ลองเปลี่ยนเป็น ถ้ากดปุ่มให้ซ่อนหน้าต่างโปรแกรม
Case $Button3
GUISetState(@SW_HIDE,$From1)
แล้วทำ
hotkeyset("{ESC}","_SHOW1")
Func _SHOW1()
GUISetState(@SW_SHOW,$From1)
EndFunc
เมื่อกดปุ่ม ESC ให้โชว์หน้าต่างโปรแกรมเหมือนเดิม
ก็ใช้งานได้ไม่มีปัญหา
แต่ต้องเอา ตัว hotkeyset("{ESC}","_SHOW1") ไปวางใน loop
ถึงจะทำงานได้
อยากถามว่าการเอาhotkeyset("{ESC}","_SHOW1") ไปวางใน loop
จะมีปัญหาอะไรหรือเปล่าครับปรกติไม่ค่อยเห็นเขาทำกัน
เครื่องจะทำงานหนักไปหรือเปล่าครับ
aut- PSsix Powerful Scripting Class
จำนวนข้อความ : 472
ความนิยม : 126
เข้าร่วมเมื่อ : 24/07/2010
- Post n°10
Re: โปรกรมตั้งเวลปิดเครื่ง
นายเอาโคดตัวเต้มมาดิ
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°11
Re: โปรกรมตั้งเวลปิดเครื่ง
โค้ดครับ
#include <GUIConstants.au3>
#include <Date.au3>
AdlibRegister ("Stime",1000)
$Form1 = GUICreate("Shutdown Windows", 319, 160, 193, 127)
$Label1 = GUICtrlCreateLabel("ใส่เวลาที่ต้องการปิดเครื่อง", 8, 8, 78, 17)
$Input1 = GUICtrlCreateInput("", 8, 32, 121, 21)
$Button1 = GUICtrlCreateButton("ตกลง", 232, 16, 75, 25)
$Button2 = GUICtrlCreateButton("ยกเลิก", 232, 56, 75, 25)
$Button3 = GUICtrlCreateButton("ซ่อน", 232, 96, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 8, 64, 217, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
While 1
hotkeyset("{ESC}","_SHOW1")
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$timex = GUICtrlRead($Input1)
If $timex <> "" Then
GUICtrlSetData($Edit1,"เวลาที่จะปิดเครื่องคือ = "&$timex)
Else
MsgBox(0,"test","Time To shutdown")
EndIf
Case $Button2
$timex = ""
GUICtrlSetData($Input1,"")
GUICtrlSetData($Edit1,"")
Case $Button3
GUISetState(@SW_HIDE,$From1)
EndSwitch
WEnd
Func Stime()
$timex = GUICtrlRead($Edit1)
If StringInStr($timex,_NowTime(4)) Then
Shutdown(1)
EndIf
EndFunc
Func _SHOW1()
GUISetState(@SW_SHOW,$From1)
EndFunc
#include <GUIConstants.au3>
#include <Date.au3>
AdlibRegister ("Stime",1000)
$Form1 = GUICreate("Shutdown Windows", 319, 160, 193, 127)
$Label1 = GUICtrlCreateLabel("ใส่เวลาที่ต้องการปิดเครื่อง", 8, 8, 78, 17)
$Input1 = GUICtrlCreateInput("", 8, 32, 121, 21)
$Button1 = GUICtrlCreateButton("ตกลง", 232, 16, 75, 25)
$Button2 = GUICtrlCreateButton("ยกเลิก", 232, 56, 75, 25)
$Button3 = GUICtrlCreateButton("ซ่อน", 232, 96, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 8, 64, 217, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
While 1
hotkeyset("{ESC}","_SHOW1")
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$timex = GUICtrlRead($Input1)
If $timex <> "" Then
GUICtrlSetData($Edit1,"เวลาที่จะปิดเครื่องคือ = "&$timex)
Else
MsgBox(0,"test","Time To shutdown")
EndIf
Case $Button2
$timex = ""
GUICtrlSetData($Input1,"")
GUICtrlSetData($Edit1,"")
Case $Button3
GUISetState(@SW_HIDE,$From1)
EndSwitch
WEnd
Func Stime()
$timex = GUICtrlRead($Edit1)
If StringInStr($timex,_NowTime(4)) Then
Shutdown(1)
EndIf
EndFunc
Func _SHOW1()
GUISetState(@SW_SHOW,$From1)
EndFunc
aut- PSsix Powerful Scripting Class
จำนวนข้อความ : 472
ความนิยม : 126
เข้าร่วมเมื่อ : 24/07/2010
- Post n°12
Re: โปรกรมตั้งเวลปิดเครื่ง
พิมชื่อ$Form1 ผิดอะมานจะขึ้นได้ไง
#include
#include
HotKeySet("{ESC}", "_SHOW1")
AdlibRegister("Stime", 1000)
$Form1 = GUICreate("Shutdown Windows", 319, 160, 193, 127)
$Label1 = GUICtrlCreateLabel("Time Shutdown", 8, 8, 78, 17)
$Input1 = GUICtrlCreateInput("", 8, 32, 121, 21)
$Button1 = GUICtrlCreateButton("Ok", 232, 16, 75, 25)
$Button2 = GUICtrlCreateButton("Reset", 232, 56, 75, 25)
$Button3 = GUICtrlCreateButton("Exit", 232, 96, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 8, 64, 217, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$timex = GUICtrlRead($Input1)
If $timex <> "" Then
GUICtrlSetData($Edit1, "time shutdown = " & $timex)
Else
MsgBox(0, "test", "Time To shutdown")
EndIf
Case $Button2
$timex = ""
GUICtrlSetData($Input1, "")
GUICtrlSetData($Edit1, "")
Case $Button3
GUISetState(@SW_HIDE, $Form1)
EndSwitch
WEnd
Func Stime()
$timex = GUICtrlRead($Edit1)
If StringInStr($timex, _NowTime(4)) Then
Shutdown(1)
EndIf
EndFunc ;==>Stime
Func _SHOW1()
GUISetState(@SW_SHOW, $Form1)
EndFunc ;==>_SHOW1
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°13
Re: โปรกรมตั้งเวลปิดเครื่ง
Form1, From1, อ่ะนะ เนียนๆ
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°14
Re: โปรกรมตั้งเวลปิดเครื่ง
ผมทำ combobox 2อันตามคำแนะนำ แต่การกำหนดเงื่อนไข
ต้องเอาค่าจากcombobox1มาต่อกับ combobox2แล้วเอามาตรวจดูว่าตรงกับเงื่อนไขหรือไม่
ในการเชื่อมตัวแปร2ตัวเข้าด้วยกันเราใช้คำสั่งไรครับ
ลอง& ไม่ได้นะครับ
ต้องเอาค่าจากcombobox1มาต่อกับ combobox2แล้วเอามาตรวจดูว่าตรงกับเงื่อนไขหรือไม่
ในการเชื่อมตัวแปร2ตัวเข้าด้วยกันเราใช้คำสั่งไรครับ
ลอง& ไม่ได้นะครับ
aut- PSsix Powerful Scripting Class
จำนวนข้อความ : 472
ความนิยม : 126
เข้าร่วมเมื่อ : 24/07/2010
- Post n°15
Re: โปรกรมตั้งเวลปิดเครื่ง
เอาสองย่าง if $ตัวแปร and $ตัวแปร then เอาย่างเดวก้อ if $ตัวแปร or $ตัวแปร then
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°16
Re: โปรกรมตั้งเวลปิดเครื่ง
#include <GUIConstants.au3>
#include <Date.au3>
HotKeySet("{ESC}","Unlcok")
AdlibRegister ("Stime",1000)
AdlibRegister ("timeupdate",1000)
Global $readcom1,$readcom2
$Form1 = GUICreate("Shutdown Timemer", 491, 180, 218, 172)
GUISetBkColor(0xFFFFFF)
$Button1 = GUICtrlCreateButton("ตกลง", 24, 120, 75, 33)
$Button2 = GUICtrlCreateButton("ยกเลิก", 144, 120, 75, 33)
$Button3 = GUICtrlCreateButton("ซ่อน", 264, 120, 75, 33)
$Button4 = GUICtrlCreateButton("ออก", 390, 120, 75, 33)
$Label1 = GUICtrlCreateLabel("เลือกเวลาที่ต้องการ", 24, 8, 292, 17)
$Edit1 = GUICtrlCreateEdit("", 24, 64, 281, 49)
GUICtrlSetData(-1, "")
$Group1 = GUICtrlCreateGroup("ขณะนี้เวลา", 334, 40, 129, 73)
$Label3 = GUICtrlCreateLabel("", 376, 72, 68, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo1 = GUICtrlCreateCombo("", 72, 32, 57, 25)
GUICtrlSetData($Combo1,"00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24")
$Combo2 = GUICtrlCreateCombo("", 192, 32, 57, 25)
GUICtrlSetData($Combo2,"00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59")
$Label2 = GUICtrlCreateLabel("เลือกเวลา", 24, 40, 44, 17)
$Label4 = GUICtrlCreateLabel("นาฬิกา", 136, 40, 52, 17)
$Label5 = GUICtrlCreateLabel("นาที", 256, 40, 52, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Read11 = GUICtrlRead($Combo1)
$Read12 = GUICtrlRead($Combo2)
If $Read11 <> "" And $Read11 <> "" Then
GUICtrlSetData($Edit1,"เวลาที่จะปิดเครื่อง = "&$Read11&":"&$Read12)
Else
MsgBox(0,"error","ยังไม่ได้เลือกกรุณาเลือกเวลา")
GUICtrlSetData($Edit1,"ยังไม่ได้ตั้งเวลาปิดเครื่อง")
EndIf
Case $Button2
$Read11 = ""
$Read11 = ""
GUICtrlSetData($Combo1,"00")
GUICtrlSetData($Combo2,"00")
GUICtrlSetData($Edit1,"No Time")
Case $Button3
GUISetState(@SW_HIDE,$Form1)
Case $Button4
Exit
EndSwitch
WEnd
Func Stime()
$timex = GUICtrlRead($Edit1)
If StringInStr($timex,_NowTime(4)) Then
Shutdown(1)
EndIf
EndFunc
Func Unlcok()
GUISetState(@SW_SHOW,$Form1)
EndFunc
Func timeupdate()
Local $xxx = _NowTime(5)
GUICtrlSetData($Label3,$xxx)
EndFunc
เอาไปโมมาใหม่ ปรับหน้าตาให้ดีขึ้น เดียวว่างๆ ปรับปรุงให้มัน logoff,restrat shutdown ได้ในตัวเดียว
#include <Date.au3>
HotKeySet("{ESC}","Unlcok")
AdlibRegister ("Stime",1000)
AdlibRegister ("timeupdate",1000)
Global $readcom1,$readcom2
$Form1 = GUICreate("Shutdown Timemer", 491, 180, 218, 172)
GUISetBkColor(0xFFFFFF)
$Button1 = GUICtrlCreateButton("ตกลง", 24, 120, 75, 33)
$Button2 = GUICtrlCreateButton("ยกเลิก", 144, 120, 75, 33)
$Button3 = GUICtrlCreateButton("ซ่อน", 264, 120, 75, 33)
$Button4 = GUICtrlCreateButton("ออก", 390, 120, 75, 33)
$Label1 = GUICtrlCreateLabel("เลือกเวลาที่ต้องการ", 24, 8, 292, 17)
$Edit1 = GUICtrlCreateEdit("", 24, 64, 281, 49)
GUICtrlSetData(-1, "")
$Group1 = GUICtrlCreateGroup("ขณะนี้เวลา", 334, 40, 129, 73)
$Label3 = GUICtrlCreateLabel("", 376, 72, 68, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo1 = GUICtrlCreateCombo("", 72, 32, 57, 25)
GUICtrlSetData($Combo1,"00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24")
$Combo2 = GUICtrlCreateCombo("", 192, 32, 57, 25)
GUICtrlSetData($Combo2,"00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59")
$Label2 = GUICtrlCreateLabel("เลือกเวลา", 24, 40, 44, 17)
$Label4 = GUICtrlCreateLabel("นาฬิกา", 136, 40, 52, 17)
$Label5 = GUICtrlCreateLabel("นาที", 256, 40, 52, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Read11 = GUICtrlRead($Combo1)
$Read12 = GUICtrlRead($Combo2)
If $Read11 <> "" And $Read11 <> "" Then
GUICtrlSetData($Edit1,"เวลาที่จะปิดเครื่อง = "&$Read11&":"&$Read12)
Else
MsgBox(0,"error","ยังไม่ได้เลือกกรุณาเลือกเวลา")
GUICtrlSetData($Edit1,"ยังไม่ได้ตั้งเวลาปิดเครื่อง")
EndIf
Case $Button2
$Read11 = ""
$Read11 = ""
GUICtrlSetData($Combo1,"00")
GUICtrlSetData($Combo2,"00")
GUICtrlSetData($Edit1,"No Time")
Case $Button3
GUISetState(@SW_HIDE,$Form1)
Case $Button4
Exit
EndSwitch
WEnd
Func Stime()
$timex = GUICtrlRead($Edit1)
If StringInStr($timex,_NowTime(4)) Then
Shutdown(1)
EndIf
EndFunc
Func Unlcok()
GUISetState(@SW_SHOW,$Form1)
EndFunc
Func timeupdate()
Local $xxx = _NowTime(5)
GUICtrlSetData($Label3,$xxx)
EndFunc
เอาไปโมมาใหม่ ปรับหน้าตาให้ดีขึ้น เดียวว่างๆ ปรับปรุงให้มัน logoff,restrat shutdown ได้ในตัวเดียว
แก้ไขล่าสุดโดย Monaliza เมื่อ 26/09/11, 09:46 am, ทั้งหมด 2 ครั้ง
Arm- PSsix Member Super Class III
-
จำนวนข้อความ : 268
ความนิยม : 54
เข้าร่วมเมื่อ : 31/03/2011
อายุ : 26
- Post n°17
Re: โปรกรมตั้งเวลปิดเครื่ง
ลองแก้ไขให้นิดนึงครับ
พี่ aut ตอบให้หน่อยนะครับ..
อ้อ! คำสั่ง AdlibRegister เอาไว้ทำอะไรครับ??
- Code:
#NoTrayIcon
#include <GUIConstants.au3>
#include <Date.au3>
Opt("TrayMenuMode", 3)
Opt("GUICloseOnESC", 0)
AdlibRegister("Stime", 1000)
AdlibRegister("timeupdate", 1000)
Global $readcom1, $readcom2
$Form1 = GUICreate("Shutdown Timer", 491, 180)
GUISetBkColor(0xFFFFFF)
$Button1 = GUICtrlCreateButton("OK", 24, 120, 75, 33)
$Button2 = GUICtrlCreateButton("RESET", 144, 120, 75, 33)
$Button3 = GUICtrlCreateButton("HIDE", 264, 120, 75, 33)
$Button4 = GUICtrlCreateButton("EXIT", 390, 120, 75, 33)
$Label1 = GUICtrlCreateLabel("Time To Shutdown", 24, 8, 292, 17)
$Edit1 = GUICtrlCreateEdit("", 24, 64, 281, 49)
GUICtrlSetData(-1, "")
$Group1 = GUICtrlCreateGroup("Time Update", 334, 40, 129, 73)
$Label3 = GUICtrlCreateLabel("", 376, 72, 68, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo1 = GUICtrlCreateCombo("00", 72, 32, 57, 25)
GUICtrlSetData($Combo1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24")
$Combo2 = GUICtrlCreateCombo("00", 192, 32, 57, 25)
GUICtrlSetData($Combo2, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59")
$Label2 = GUICtrlCreateLabel("TIME", 24, 40, 44, 17)
$Label4 = GUICtrlCreateLabel("HOUR", 136, 40, 52, 17)
$Label5 = GUICtrlCreateLabel("MIN", 256, 40, 52, 17)
$MenuItem1 = TrayCreateItem("โชว์หน้าต่างโปรแกรม")
$MenuItem2 = TrayCreateItem("ออกจากโปรแกรม")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Read11 = GUICtrlRead($Combo1)
$Read12 = GUICtrlRead($Combo2)
If $Read11 <> "" And $Read11 <> "" Then
GUICtrlSetData($Edit1, "Time To Shutdown = " & $Read11 & ":" & $Read12)
Else
MsgBox(0, "error", "Time To Shutdown")
GUICtrlSetData($Edit1, "No Time")
EndIf
Case $Button2
$Read11 = ""
$Read12 = ""
GUICtrlSetData($Combo1, "00")
GUICtrlSetData($Combo2, "00")
GUICtrlSetData($Edit1, "No Time")
Case $Button3
Hide()
Case $Button4
Exit
Case $MenuItem1
Show()
Case $MenuItem2
If $Read11 And $Read12 <> "" Then
$iMsgBoxAnswer = MsgBox(292,"Exit?","ต้องการยกเลิกการตั้งเวลาหรือไม่")
Select
Case $iMsgBoxAnswer = 6 ;Yes
Exit
EndSelect
EndIf
EndSwitch
WEnd
Func Stime()
$timex = GUICtrlRead($Edit1)
If StringInStr($timex, _NowTime(4)) Then
Shutdown(0)
EndIf
EndFunc ;==>Stime
Func Hide()
GUISetState(@SW_HIDE, $Form1)
Opt("TrayIconHide", 0)
TrayTip("Shutdown Timer", "ซ่อนตัวแล้วจ้า.. ^^", -1, 1)
Sleep(5000)
TrayTip("", "", "")
EndFunc ;==>Hide
Func Show()
GUISetState(@SW_SHOW, $Form1)
Opt("TrayIconHide", 1)
EndFunc
Func timeupdate()
Local $xxx = _NowTime(5)
GUICtrlSetData($Label3, $xxx)
EndFunc ;==>timeupdate
พี่ aut ตอบให้หน่อยนะครับ..
อ้อ! คำสั่ง AdlibRegister เอาไว้ทำอะไรครับ??
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°18
Re: โปรกรมตั้งเวลปิดเครื่ง
ขอบคุณทุกคำแนะนำครับ
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°19
Re: โปรกรมตั้งเวลปิดเครื่ง
แทรกรูปภาพยังไงครับ
Arm- PSsix Member Super Class III
-
จำนวนข้อความ : 268
ความนิยม : 54
เข้าร่วมเมื่อ : 31/03/2011
อายุ : 26
- Post n°20
Re: โปรกรมตั้งเวลปิดเครื่ง
ในโปรแกรมเหรอครับ
Monaliza- PSsix Member Super Class III
จำนวนข้อความ : 213
ความนิยม : 7
เข้าร่วมเมื่อ : 03/10/2010
- Post n°21
Re: โปรกรมตั้งเวลปิดเครื่ง
ในบอดร์ครับ
Arm- PSsix Member Super Class III
-
จำนวนข้อความ : 268
ความนิยม : 54
เข้าร่วมเมื่อ : 31/03/2011
อายุ : 26
- Post n°22
Re: โปรกรมตั้งเวลปิดเครื่ง
ทำประมาณนี้แหละครับ
Arm- PSsix Member Super Class III
-
จำนวนข้อความ : 268
ความนิยม : 54
เข้าร่วมเมื่อ : 31/03/2011
อายุ : 26
- Post n°23
Re: โปรกรมตั้งเวลปิดเครื่ง
หรือจะอัพรูปจากที่นี่ก็ได้นะครับ
Upload Picture !! (Thai)
Upload Picture !! (Thai)
|
|