Belfigor Posted October 13, 2008 Share Posted October 13, 2008 Hi. I have test.txt file, it looks like [Corporation Management] [starbase Defense Management III] [02.11.2008 7:05:20] [Drones] [Drones V] [05.11.2008 13:11:19] [Drones] [Drone Interfacing I] [05.11.2008 13:51:12] in that file i must take date and time of 1st line, and use it in this script: $timer = 0 Do $timer = 0 If @MDAY = $Mday Then if @MON = $Mon Then if @YEAR = $Year Then if @HOUR = $Hour Then if @MIN = $Min Then if @SEC = $Sec Then Action() $Timer = 1 EndIf endif endif endif endif endif Until $Timer = 1 How can i do it? [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 13, 2008 Moderators Share Posted October 13, 2008 (edited) Local $s_file = "test.txt" While 1 If _my_FileCompare_myInfo($s_file, @MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC) Then ;Function call or other stuff here EndIF Sleep(900) WEnd Func _my_FileCompare_myInfo($s_file, $i_month, $i_day, $i_year, $i_hour, $i_min, $i_sec) Local $s_file_read = FileRead($s_file) Local $a_first_line_date_time = StringRegExp($s_file_read, "\[(\d+)\.(\d+)\.(\d+)\s+(\d+):(\d+):(\d+)\]", 1) If @error Then Return SetError(1, 0, 0) If Int($i_month) <> Int($a_first_line_date_time[0]) Then Return SetError(2, 0, 0) If Int($i_day) <> Int($a_first_line_date_time[1]) Then Return SetError(3, 0, 0) If Int($i_year) <> Int($a_first_line_date_time[2]) Then Return SetError(4, 0, 0) If Int($i_hour) <> Int($a_first_line_date_time[3]) Then Return SetError(5, 0, 0) If Int($i_min) <> Int($a_first_line_date_time[4]) Then Return SetError(6, 0, 0) If Int($i_sec) <> Int($a_first_line_date_time[5]) Then Return SetError(7, 0, 0) Return 1 EndFunc Edit: Disabled Emoticons Edited October 13, 2008 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. Link to comment Share on other sites More sharing options...
Belfigor Posted October 13, 2008 Author Share Posted October 13, 2008 Thank you!. Will test it in soon [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now