Sign in to follow this  
Followers 0
thenewkid

_nowtime help

6 posts in this topic

Hi this script works good but if the clock hits over 00:00 then it will close the notepad does any one know how to make it not to close the notepad intill 06:00

#include <Date.au3>
$pro = "Untitled - Notepad"
Func _Time()
$Time = _NowTime(4)
if $Time <= "19:00" Then
    WinClose($pro)
Else
    
EndIf
EndFunc

Func _IFprorun()
While 1
    If WinExists($pro) Then
        _Time()
    Else
        Sleep(500)
    EndIf
WEnd
EndFunc

ProcessSetPriority("nopro.exe",0)
;to lower drag on cpu
_IFprorun()

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Share this post


Link to post
Share on other sites



Global $sTitleOfWin = 'Untitled - Notepad'
Global $sHourShutdown = '19', $sMinuteShutDown = '00'
AdlibEnable('_IfProRun', 1000)

While 1
    Sleep(0x7FFFFFFF)
WEnd

Func _IfProRun()
    If WinExists($sTitleOfWin) Then
        If Int(@HOUR) = Int($sHourShutdown) And Int(@MIN) >= Int($sMinuteShutDown) Then
            WinClose($sTitleOfWin)
        EndIf
    EndIf
EndFunc


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Thanks smoke but that script does not do what i need it to ive been working on mine with a bit of help from yours but it all ways shows the 2ed msgbox and not the first when i think it shold can any one help

#include <Date.au3>
$pro = "Untitled - Notepad"
Func _Time()
$Time = _NowTime(4)

if $Time >= "19:00" And $Time <= "06:00" Then
    MsgBox(0,"","in the time zone")
Else
    MsgBox(0,"","out side the zime zone")
    WinClose($pro)
    EndIf
EndFunc

Func _IFvodorun()
While 1
    If WinExists($pro) Then
        _Time()
    Else
        Sleep(500)
    EndIf
WEnd
EndFunc

;main-----------------
ProcessSetPriority("nopro.exe",0)
_IFvodorun()

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks smoke but that script does not do what i need it to ive been working on mine with a bit of help from yours but it all ways shows the 2ed msgbox and not the first when i think it shold can any one help

#include <Date.au3>
$pro = "Untitled - Notepad"
Func _Time()
$Time = _NowTime(4)

if $Time >= "19:00" And $Time <= "06:00" Then
    MsgBox(0,"","in the time zone")
Else
    MsgBox(0,"","out side the zime zone")
    WinClose($pro)
    EndIf
EndFunc

Func _IFvodorun()
While 1
    If WinExists($pro) Then
        _Time()
    Else
        Sleep(500)
    EndIf
WEnd
EndFunc

;main-----------------
ProcessSetPriority("nopro.exe",0)
_IFvodorun()
Um, you just want to shut down a window at a certain hour and minute? That's exactly what the script that I gave you does.

Edit:

Yep, just verified... Shuts it down when the hour I want to is = to, and the minute I want to is = to.

Are you trying to shut it down between the hours of xx and xx?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

no i want it to shutdown a window if the time is <=19:00 And >= 06:00

and shuts it down if the time is not within the 13hr timezone

so if the zime is 03:00 it will keep it opan and if the time is 15:00 it will close the window

Edited by thenewkid

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Share this post


Link to post
Share on other sites

no i want it to shutdown a window if the time is <=19:00 And >= 06:00

and shuts it down if the time is not within the 13hr timezone

so if the zime is 03:00 it will keep it opan and if the time is 15:00 it will close the window

Global $sTitleOfWin = 'Untitled - Notepad'
Global $sHourShutdown1 = '19', $sMinuteShutDown1 = '00', $sHourShutdown2 = '06', $sMinuteShutDown2 = '00'
AdlibEnable('_IfProRun', 1000)

While 1
    Sleep(0x7FFFFFFF)
WEnd

Func _IfProRun()
    If WinExists($sTitleOfWin) Then
        If (Int(@HOUR) <= Int($sHourShutdown1) And Int(@MIN) <= Int($sMinuteShutDown1)) And _
            (Int(@HOUR) >= Int($sHourShutdown2) And Int(@MIN) >= Int($sMinuteShutDown2)) Then
            WinClose($sTitleOfWin)
        EndIf
    EndIf
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0