Rogue5099 Posted July 12, 2008 Share Posted July 12, 2008 I am wanting to run a IniWirte every even or odd number but in a never ending loop (hince Until -1). Somthing like this: While 1 Do $a = $a + 1 _Func1() _Func2() ???If $a = ODDNUMBER Then??? IniWrite(.....) ???If $a = EVENNUMBER Then??? IniWrite(.....) _Func3() _Func4() Sleep(2000) Until $a = -1 WEnd All help is apperciated!!! My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
GEOSoft Posted July 12, 2008 Share Posted July 12, 2008 If Mod($a, 2) = 0 Then ;; The number is even George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 12, 2008 Share Posted July 12, 2008 If IsInt($a/2) Then... .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Rogue5099 Posted July 12, 2008 Author Share Posted July 12, 2008 Mod in AutoIt Help! That gives great example thank you for helping!!!! My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
GEOSoft Posted July 12, 2008 Share Posted July 12, 2008 (edited) If IsInt($a/2) Then...If IsInt(10/2) Then ?????????Edit: Oooops. Forget this one. Edited July 12, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
martin Posted July 12, 2008 Share Posted July 12, 2008 (edited) If IsInt(10/2) Then ?????????Sorry about this GEOSoft but I couldn't resist it. $AdmiralAlkex = 0 $Geosoft = 0 For $n = 1 To 100 $a = IsInt($n / 2) $b = Mod($n, 2) = 0 If $a <> $b Then $Geosoft += 1 Else $AdmiralAlkex += 1 EndIf Next MsgBox(0, "Scores", "AdmiralAlkex has " & $AdmiralAlkex & "%" &@CRLF & "Geosoft has " & $Geosoft & "%") Edited July 12, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
GEOSoft Posted July 12, 2008 Share Posted July 12, 2008 (edited) @martin. Your example is flawed. So was my 10/2 example by the way. $AdmiralAlkex = 0 $Geosoft = 0 For $n = 1 To 100 If Mod($n, 2) = 0 Then $Geosoft += 1 If IsInt($n/2) Then $AdmiralAlkex += 1 Next MsgBox(0, "Scores", "AdmiralAlkex has " & $AdmiralAlkex & "%" &@CRLF & "Geosoft has " & $Geosoft & "%") Edited July 12, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
andybiochem Posted July 12, 2008 Share Posted July 12, 2008 heh $number = 122 If Not BitAND($number,1) Then MsgBox(0,"","even number") muttley - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
GEOSoft Posted July 12, 2008 Share Posted July 12, 2008 heh $number = 122 If Not BitAND($number,1) Then MsgBox(0,"","even number") muttleyThat works too. So far the OP has 3 methods. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
monoceres Posted July 12, 2008 Share Posted July 12, 2008 Another solution: $number=10 If Int($number/2)=$number/2 Then MsgBox(0,"Info",$number&" is even") Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 12, 2008 Share Posted July 12, 2008 If IsInt(10/2) Then ????????? Edit: Oooops. Forget this one.lol @ GEOSoft muttley Another solution: $number=10 If Int($number/2)=$number/2 Then MsgBox(0,"Info",$number&" is even")What is it with swedes and integers? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
martin Posted July 13, 2008 Share Posted July 13, 2008 @martin. Your example is flawed. So was my 10/2 example by the way. $AdmiralAlkex = 0 $Geosoft = 0 For $n = 1 To 100 If Mod($n, 2) = 0 Then $Geosoft += 1 If IsInt($n/2) Then $AdmiralAlkex += 1 Next MsgBox(0, "Scores", "AdmiralAlkex has " & $AdmiralAlkex & "%" &@CRLF & "Geosoft has " & $Geosoft & "%")Yes that's true, 100% each would be correct! No offence intended. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
GEOSoft Posted July 13, 2008 Share Posted July 13, 2008 Yes that's true, 100% each would be correct! No offence intended.When do I take offence? Actually, when do I pay attention? muttley George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
system24 Posted July 14, 2008 Share Posted July 14, 2008 ; just to check if $number is not 0 If $number > 0 Then If Mod($number, 2) = 1 Then ; number is odd Else ; number is even EndIf EndIf [center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center] Link to comment Share on other sites More sharing options...
martin Posted July 14, 2008 Share Posted July 14, 2008 ; just to check if $number is not 0 If $number > 0 Then If Mod($number, 2) = 1 Then ; number is odd Else ; number is even EndIf EndIf No need for that because 0 is an even number and the previous tests would show that. An integer n is called *even* if there exists an integer m such that n = 2m, and odd if n+1 is even. Since 0 = 2 * 0 and there is no integer m where 2*m = 0 + 1 then it is even. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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