mrflibblehat Posted December 8, 2013 Share Posted December 8, 2013 (edited) So i have a value of 0.000001 and I want it to increment by 0.000001 every second. Everytime I try this I just get a rounded number of 1 and not 0.000002, 0.000003, 0.000004 as expected. Please can anyone help I must add this this needs to be shown in a label on the gui #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 386, 95, 192, 124) $Label1 = GUICtrlCreateLabel("Label1", 64, 24, 228, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $vDec = 0.000001 $vDec2 = 0.000002 $vAdd = $vDec + $vDec2 GUICtrlSetData($Label1, $vAdd) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Im sure its something to do with strings/dec/int but I cant work it out. Edited December 8, 2013 by mrflibblehat [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font] Link to comment Share on other sites More sharing options...
water Posted December 8, 2013 Share Posted December 8, 2013 Can you please be so kind and post the code you use? Or at least a small reproducer script? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 8, 2013 Share Posted December 8, 2013 Because 0.000001 is 1*10-6 you will get results like "1e-006" by AutoIt. Example: For $i = 0.000001 To 0.0001 Step 0.000001 ConsoleWrite($i & @LF) Next returns: expandcollapse popup1e-006 2e-006 3e-006 4e-006 5e-006 6e-006 7e-006 8e-006 9e-006 1e-005 1.1e-005 1.2e-005 1.3e-005 1.4e-005 1.5e-005 1.6e-005 1.7e-005 1.8e-005 1.9e-005 2e-005 2.1e-005 2.2e-005 2.3e-005 2.4e-005 2.5e-005 2.6e-005 2.7e-005 2.8e-005 2.9e-005 3e-005 3.1e-005 3.2e-005 3.3e-005 3.4e-005 3.5e-005 3.6e-005 3.7e-005 3.8e-005 3.9e-005 4e-005 4.1e-005 4.2e-005 4.3e-005 4.4e-005 4.5e-005 4.6e-005 4.7e-005 4.8e-005 4.9e-005 5e-005 5.1e-005 5.19999999999999e-005 5.29999999999999e-005 5.39999999999999e-005 5.49999999999999e-005 5.59999999999999e-005 5.69999999999999e-005 5.79999999999999e-005 5.89999999999999e-005 5.99999999999999e-005 6.09999999999999e-005 6.19999999999999e-005 6.29999999999999e-005 6.39999999999999e-005 6.49999999999999e-005 6.59999999999999e-005 6.69999999999999e-005 6.79999999999999e-005 6.89999999999999e-005 6.99999999999999e-005 7.09999999999999e-005 7.19999999999999e-005 7.29999999999999e-005 7.39999999999999e-005 7.49999999999999e-005 7.59999999999999e-005 7.69999999999999e-005 7.79999999999999e-005 7.89999999999999e-005 7.99999999999999e-005 8.09999999999999e-005 8.19999999999999e-005 8.29999999999999e-005 8.39999999999999e-005 8.49999999999999e-005 8.59999999999999e-005 8.69999999999999e-005 8.79999999999998e-005 8.89999999999998e-005 8.99999999999998e-005 9.09999999999998e-005 9.19999999999998e-005 9.29999999999998e-005 9.39999999999998e-005 9.49999999999998e-005 9.59999999999998e-005 9.69999999999998e-005 9.79999999999998e-005 9.89999999999998e-005 9.99999999999998e-005 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mrflibblehat Posted December 8, 2013 Author Share Posted December 8, 2013 Because 0.000001 is 1*10-6 you will get results like "1e-006" by AutoIt. Example: For $i = 0.000001 To 0.0001 Step 0.000001 ConsoleWrite($i & @LF) Next returns: expandcollapse popup1e-006 2e-006 3e-006 4e-006 5e-006 6e-006 7e-006 8e-006 9e-006 1e-005 1.1e-005 1.2e-005 1.3e-005 1.4e-005 1.5e-005 1.6e-005 1.7e-005 1.8e-005 1.9e-005 2e-005 2.1e-005 2.2e-005 2.3e-005 2.4e-005 2.5e-005 2.6e-005 2.7e-005 2.8e-005 2.9e-005 3e-005 3.1e-005 3.2e-005 3.3e-005 3.4e-005 3.5e-005 3.6e-005 3.7e-005 3.8e-005 3.9e-005 4e-005 4.1e-005 4.2e-005 4.3e-005 4.4e-005 4.5e-005 4.6e-005 4.7e-005 4.8e-005 4.9e-005 5e-005 5.1e-005 5.19999999999999e-005 5.29999999999999e-005 5.39999999999999e-005 5.49999999999999e-005 5.59999999999999e-005 5.69999999999999e-005 5.79999999999999e-005 5.89999999999999e-005 5.99999999999999e-005 6.09999999999999e-005 6.19999999999999e-005 6.29999999999999e-005 6.39999999999999e-005 6.49999999999999e-005 6.59999999999999e-005 6.69999999999999e-005 6.79999999999999e-005 6.89999999999999e-005 6.99999999999999e-005 7.09999999999999e-005 7.19999999999999e-005 7.29999999999999e-005 7.39999999999999e-005 7.49999999999999e-005 7.59999999999999e-005 7.69999999999999e-005 7.79999999999999e-005 7.89999999999999e-005 7.99999999999999e-005 8.09999999999999e-005 8.19999999999999e-005 8.29999999999999e-005 8.39999999999999e-005 8.49999999999999e-005 8.59999999999999e-005 8.69999999999999e-005 8.79999999999998e-005 8.89999999999998e-005 8.99999999999998e-005 9.09999999999998e-005 9.19999999999998e-005 9.29999999999998e-005 9.39999999999998e-005 9.49999999999998e-005 9.59999999999998e-005 9.69999999999998e-005 9.79999999999998e-005 9.89999999999998e-005 9.99999999999998e-005 Thanks Water, Does that mean that there is no way to get to what I want to achieve? [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font] Link to comment Share on other sites More sharing options...
water Posted December 8, 2013 Share Posted December 8, 2013 Function StringFormat comes to my mind. But I haven't tried it yet ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 8, 2013 Share Posted December 8, 2013 You need something like this: For $i = 0.000001 To 0.0001 Step 0.000001 ConsoleWrite(StringFormat("%1.6f", $i) & @LF) Next mrflibblehat 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Solution mikell Posted December 8, 2013 Solution Share Posted December 8, 2013 #include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 386, 95, 192, 124) $Label1 = GUICtrlCreateLabel("0.000001", 64, 24, 228, 33) GUISetState() $vDec = 0.000001 AdLibRegister("_add", 500) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _add() $vDec = $vDec + 1*10^-6 GUICtrlSetData($Label1, StringFormat("%.6f", $vDec)) EndFunc mrflibblehat 1 Link to comment Share on other sites More sharing options...
mrflibblehat Posted December 8, 2013 Author Share Posted December 8, 2013 Thank you both for your very details answers, but Mikells helped me out perfectly [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font] 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