Sodori Posted December 8, 2014 Share Posted December 8, 2014 Hi all! Local $search = _IEGetObjById($oIE, "header") Local $timer = TimerInit() ConsoleWrite(TimerDiff($timer) & @LF) Local $display = StringInStr($search.innerhtml, "display: block;") While $display = 0 If TimerDiff($search) > 5000 Then ConsoleWrite("Time out after " & TimerDiff($search) & " ms!!" & @LF) Exit Else $display = StringInStr($search.innerhtml, "display: block;") EndIf WEnd Is a part of a really, long code project I am working on, this is the console message this gives me: 0.00192438451768509 Time out after 354672803.592826 ms!! Anyone knows why this happens, and more importantly, where I've been a dum dum? Because I can't see it! It's always the programmers fault not the program itself, but this is really stretching that saying in my opinion! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 8, 2014 Moderators Share Posted December 8, 2014 Sodori, It's always the programmers fault not the program itselfSeems a perfectly reasonable statement to me: ; Declaring variables Local $search = _IEGetObjById($oIE, "header") ; Object Local $timer = TimerInit() ; Timestamp ; Determining time difference ConsoleWrite(TimerDiff($timer) & @LF) ; Timestamp If TimerDiff($search) > 5000 Then ; Object ?????? ConsoleWrite("Time out after " & TimerDiff($search) & " ms!!" & @LF)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Solution MyEarth Posted December 8, 2014 Solution Share Posted December 8, 2014 Local $timer = TimerInit() Local $dif = TimerDiff($timer) ConsoleWrite($dif & @LF) While 1 $dif = TimerDiff($timer) If $dif > 5000 Then ConsoleWrite($dif & @CR) ExitLoop EndIf WEnd Result: 0.127669857481887 5000.00642539764 Sodori 1 Link to comment Share on other sites More sharing options...
kylomas Posted December 8, 2014 Share Posted December 8, 2014 @MyEarth - Do you think there might be a reason for M23 to respond as he did??? Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Sodori Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) Sodori, Seems a perfectly reasonable statement to me: ; Declaring variables Local $search = _IEGetObjById($oIE, "header") ; Object Local $timer = TimerInit() ; Timestamp ; Determining time difference ConsoleWrite(TimerDiff($timer) & @LF) ; Timestamp If TimerDiff($search) > 5000 Then ; Object ?????? ConsoleWrite("Time out after " & TimerDiff($search) & " ms!!" & @LF) M23 I am sorry, M23? xD The If statement is pretty much a artificial timeout. If the program can't find the object within 5 seconds, then nothing will happen. Else, it will exit out of the while loop thus render the if forgotten. Sorry that I didn't mention this before Let's just blame Monday mornings? Edit: Seems MyEarth is the hero here.. or the ninja rep stealer from Melba (not that you need it ) Local $search = _IEGetObjById($oIE, "header") $timer = TimerInit() ConsoleWrite(TimerDiff($timer) & @LF) Local $display = StringInStr($search.innerhtml, "display: block;") While $display = 0 Local $diff = TimerDiff($timer) If $diff > 5000 Then ConsoleWrite("Time out after " & TimerDiff($search) & " ms!!" & @LF) Exit Else ConsoleWrite("Not yet! Time passed: " & $diff & @LF) $display = StringInStr($search.innerhtml, "display: block;") EndIf WEnd Make a $diff value instead did the trick. Really can't comprehend why it would add about 300,000 seconds to the $timer unless I did that. But oh well, thanks! Edited December 8, 2014 by Sodori Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 8, 2014 Moderators Share Posted December 8, 2014 Sodori,The point I was trying to make is that you are using the wrong variable in the If TimerDiff statement - I was obviously too oblique for a Monday morning. M23 Sodori 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Sodori Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) Quite it is Melba xD Sorry it's Monday morning, I got a metric ton of stuff in my head not to mention trying to get back into my lines after a weekend of forgetfulness, regrets and a bit of headache. I still ain't too sure that you are insinuating. But Earth helped me, I hope what he said was pretty much close enough to what you menth PS. Did edit my post #5, unless noticed. PPS. I am editing my posts way too much, I need to stop this and get my head away from here xD Edited December 8, 2014 by Sodori Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2014 Share Posted December 8, 2014 <flogging dead horse> AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MyEarth Posted December 8, 2014 Share Posted December 8, 2014 @MyEarth - Do you think there might be a reason for M23 to respond as he did??? Do you think i see it? I was write the post when Melba post it 2 minutes ( not 10 minutes, 1 hour or 10 hours ) before mine, come'on you are a MVP i don't need to tell you "think before post", or not? Link to comment Share on other sites More sharing options...
Sodori Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) You must understand MyEarth, since it's Monday he might be a bit high on coffee or any other sugar related liquid 2 min for you probably 20 hours for him ^^ It's a thesis though! Edited December 8, 2014 by Sodori Link to comment Share on other sites More sharing options...
kylomas Posted December 8, 2014 Share Posted December 8, 2014 @Sodori - Yes, not enough coffee on Earth at 3:55 AM...The important point is for you to see that $search was the wrong var to use in TimerDiff(). Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Sodori Posted December 8, 2014 Author Share Posted December 8, 2014 Oh, goodness me xD Yes, yes that is slight wrong way to use it >.< Kinda needs a second pair of brains here at my work who understands AutoIt, maybe then I can sort such embarrassing things out on my own xD Thank you all! I am such a dum dum sometimes.. Were looking at that line for about three hours last Friday, only to not even solve it after a weekends rest.. 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