kylomas Posted November 28, 2011 Share Posted November 28, 2011 I found this stmt in a GDI+ example that I was looking at and do NOT understand it. Can someone explain it please? Until False * Not Sleep(30) Thanks, kylomas 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...
water Posted November 28, 2011 Share Posted November 28, 2011 (edited) It always evaluates to 0. Sleep(30) returns 1. Not Sleep(30) therefore evaluates to 0. False = 0. So 0 * 0 = 0. There must be a statement in the Do Until loop to exit the loop. Edited November 28, 2011 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
kylomas Posted November 28, 2011 Author Share Posted November 28, 2011 water, Yes, that is how I interpreted it but thought that I must be missing something. Why not just code "until 1"? This is the entire loop (forgot which thread I got it from)Do _GDIPlus_GraphicsClear($backbuffer, 0x90000000) For $x = 1 To UBound($arrTxt1) - 1 $x1 = $width_mul_045 + Cos(($i + $m) * $pi_div_180) * $radius_x1 $y1 = $height_mul_045 + Sin(($i + $m) * $pi_div_180) * $radius_y1 - $fontsize_txt1 / 4 $arrX1[$x] = $x1 $arrY1[$x] = $y1 DllStructSetData($tLayout, "x", $arrX1[$x]) DllStructSetData($tLayout, "y", $arrY1[$x]) _GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt1[$x], $hFont1, $tLayout, $hFormat, $brush1[$x]) $m += $a Next For $x = 1 To UBound($arrTxt2) - 1 $x2 = $width_mul_045 + Cos(($j + $n) * $pi_div_180) * $radius_x2 * Cos($y * $pi_div_180) $y2 = $height_mul_045 + Sin(($j + $n) * $pi_div_180) * $radius_y2 - $fontsize_txt2 / 4 $arrX2[$x] = $x2 $arrY2[$x] = $y2 DllStructSetData($tLayout, "x", $arrX2[$x]) DllStructSetData($tLayout, "y", $arrY2[$x]) _GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt2[$x], $hFont2, $tLayout, $hFormat, $brush2[$x]) $n += $b Next If Mod($y, 2) = 1 Then Array_Shift($brush2, 1) $y += 1 _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) $i += 1 ;~ If $i >= 360 Then ;~ $i = 0 ;~ $m = 0 ;~ EndIf $j -= 2 ;~ If $j <= 0 Then ;~ $j = 360 ;~ $n = 0 ;~ EndIf Until False * Not Sleep(30) kylomas 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...
water Posted November 28, 2011 Share Posted November 28, 2011 Because the Do Until statement is evaluated at the end of the loop until the expression is true. Until 1 would end the loop after 1 round. Until 0 loops forever and therefore needs a statement in the loop to exit."Do Until 0" is nearly the same as "While 1 WEnd". The only difference is that the expression is evaluated at the beginning of the loop.Therefore the statements in a While loop could never be executed whereas the statements in an Until loop are at least executed once. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
kylomas Posted November 28, 2011 Author Share Posted November 28, 2011 water, Yes, my mistake, my point, however, remains. What is the purpose of the multiplication on a sleep stmt? That is what got me to believe that I was missing something. This code is from "rotating letters" by UEZ, perhaps he could offer some input??? kylomas 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...
water Posted November 28, 2011 Share Posted November 28, 2011 Maybe what we are doing here was intended. Looks like some kind of obfuscation. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted November 28, 2011 Share Posted November 28, 2011 What I don't understand is how the loop ever ends. There is no exit statement in the code you posted. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
BrewManNH Posted November 28, 2011 Share Posted November 28, 2011 Looks like he was putting a sleep into the loop and at the same time making it an endless loop. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
UEZ Posted November 28, 2011 Share Posted November 28, 2011 Let me try to explain Until False * Not Sleep(30) is the same as DoSleep(30)Until FalseFalse is the expression and the expression is tested after the loop is executed. That means as water already mentioned Sleep(30) will be execute and Sleep() returns always True but the Not negate it to false. 0 * 0 is always 0 which is equivalent to False.The loop never ends. Exit code is handled by GUIOnEventMode.Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
water Posted November 28, 2011 Share Posted November 28, 2011 Thanks for shedding some light on the subject! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
kylomas Posted November 28, 2011 Author Share Posted November 28, 2011 UEZ, Very clever, thanks for the explanation... kylomas 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...
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