Jump to content
ahmetpi

I need help to run something at a specific time

Recommended Posts

Hi,
I am kinda noob

I have an ini file which contains time and website url.
I want the website to be opened at the time specified as the key in the ini file.
I made a simple program. But it's run exe only the first key and value in the ini file.
How can I loop this? Thanks in advance

example ini file:

[MONDAY]
06:00=https://google.com/       
07:00=https://facebook.com/

my code:

Global $inifile = IniReadSection(@ScriptDir & "\example.ini", "MONDAY")

$hour1 = $inifile[1][0]
$url1 = $inifile[0][1]
$hour2 = $inifile[2][0]
$url2 = $inifile[2][1]

While 1
    $nMsg = GUIGetMsg()
    If ($hour1 = @HOUR & ":" & @MIN) Then
        ShellExecute($url1)
    ElseIf ($hour2 = @HOUR & ":" & @MIN) Then
        ShellExecute($url2)
    EndIf
WEnd

please help

* I'm sorry for my bad English

Share this post


Link to post
Share on other sites

Here to start you up :

#include <Array.au3>

HotKeySet("{ESC}", _Exit)

Global $inifile = IniReadSection(@ScriptDir & "\Test.ini", "MONDAY")
_ArrayColInsert($inifile,2)
While 1
  For $i = 1 to $inifile[0][0]
    If Not $inifile[$i][2] And $inifile[$i][0] = @HOUR & ":" & @MIN Then
      $inifile[$i][2] = True
      ShellExecute($inifile[$i][1])
    EndIf
  Next
  Sleep (1000)
WEnd

Func _Exit()
  Exit
EndFunc

 

Edited by Nine

Share this post


Link to post
Share on other sites

It worked. Thank you for helping 

41 minutes ago, Nine said:

Here to start you up :

#include <Array.au3>

HotKeySet("{ESC}", _Exit)

Global $inifile = IniReadSection(@ScriptDir & "\Test.ini", "MONDAY")
_ArrayColInsert($inifile,2)
While 1
  For $i = 1 to $inifile[0][0]
    If Not $inifile[$i][2] And $inifile[$i][0] = @HOUR & ":" & @MIN Then
      $inifile[$i][2] = True
      ShellExecute($inifile[$i][1])
    EndIf
  Next
  Sleep (1000)
WEnd

Func _Exit()
  Exit
EndFunc

 

 

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...