BeZ Posted August 24, 2006 Author Posted August 24, 2006 (edited) way too complicated for me lol... I'll never be able to implement that in my final code Is there a way my $cout return the correct value and not 0.75 ? would be easier for me MsgBox(0, "Total", "Your Total With Tax Comes to:"&@CRLF&"$"&Round($Charge*1.07),2) We don't have the same tax and I don't want the tax in this price but thats only removing *1.07 and With Tax Comes to... And wow youre taxes are low arn't they ? However just to help you a little bit more I'll give you my final code. Some words in french but that's not important. expandcollapse popup#include <GuiConstants.au3> ;NoTrayIcon MsgBox(0, "Compteur", "Lancement du script compteur") Dim $cout bloquage() Func Bloquage() MsgBox (0, "Cout", $prix & " $ + taxes") GuiCreate("blocked", 1024, 768, 0, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $Debuter = GUICtrlCreateButton("Cliquez pour débuter", 452, 374, 120) GUICtrlSetOnEvent($Debuter, "Compteur") While 1 GUISetState() $msg = GUIGetMsg() If $msg = $GUI_EVENT_PRIMARYDOWN Then ExitLoop WEnd GUIDelete () Compteur() EndFunc Func Compteur() For $cout = 0.75 to 0.76 step 0.01 ToolTip(Round($cout,2)&"$ +tx.", 0, 0) Sleep (5000) Next For $cout = 0.75 To 2.5 Step 0.01 ToolTip(Round($cout,2)&"$ +tx.", 0, 0) Sleep(120) Next Bloquage () EndFunc Also, as I said before, i would like to have a "stop" button instead of waiting for $cout to get to 2.5. Is there a way I can do this with tooltips ? Edited August 24, 2006 by BeZ
BeZ Posted August 24, 2006 Author Posted August 24, 2006 (edited) Here is one of my try to solve this expandcollapse popup#include <GuiConstants.au3> ;#NoTrayIcon MsgBox(0, "Compteur", "Lancement du script compteur") Dim $cout bloquage() Func prix() MsgBox (0, "Cout", $prix & " $ + taxes") Blocage() EndFunc Func Bloquage() GuiCreate("blocked", 1024, 768, 0, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $Debuter = GUICtrlCreateButton("Cliquez pour débuter", 452, 374, 120) GUICtrlSetOnEvent($Debuter, "Compteur") While 1 GUISetState() $msg = GUIGetMsg() If $msg = $GUI_EVENT_PRIMARYDOWN Then ExitLoop WEnd GUIDelete () Declarationprix() EndFunc Func Declarationprix() Dim $prix compteur () EndFunc Func Compteur() For $cout = 0.75 to 0.76 step 0.01 ToolTip(Round($cout,2)&"$ +tx.", 0, 0) Sleep (2500) Next For $cout = 0.75 To 2.5 Step 0.01 ToolTip(Round($cout,2)&"$ +tx.", 0, 0) Sleep(120) $cout = $prix Next Bloquage () EndFunc I added a function to declare $prix but when it still says the variable is not declared Edited August 24, 2006 by BeZ
Paulie Posted August 24, 2006 Posted August 24, 2006 (edited) way too complicated for me lol...Whats Complicated? This is using what the timer functions were MEANT to do, its really easy I'll give you a Point-by-point so you can see But first, you need to understand how TimerInt/Diff works, so i will explain Timerint is called, and it returns a timestamp, as in the current time, then, when timerdiff is called, it get another timestamp, then gets the difference between the new one and old one in milliseconds. Simple. HotKeySet("{ESC}", "End_Timer") Global $Timer= "",$Total, $Charge, $LegTime, $Final[3] oÝ÷ Ù8b²«¶+,jey'¶)ඪº^Ú®¢Øh¶G²jw]yÉZ®)à+Ú®&ë² hm©l¢ØZ¶Ø^ÉƧmë¬yÚ.¶Èzߺ{b¢{,¶¸¤{û-®)jëh×6 Sleep(3000) Start_Timer() oÝ÷ Øbv}ý¶IèÂ0Ê°j{^vØb²Ú,µªínë_¢·^춶â§^ÜÝìyÊ'vËaz{-j»X¢ç(ºWfjG¢¶ËZ®Ú'j-쨮f¤y¡!©Ý«ÞÚîúè¦î¶Ú'²Úâï춸¤y«¢+Ø)]¡¥±Ä(%¹½ÐÀÌØíQ¥µÈôÅÕ½ÐìÅÕ½ÐìÑ¡¸(ÀÌØí¥ôQ¥µÉ¥ ÀÌØíQ¥µÈ¤(ÀÌØí¥¹°ô ±Õ±Ñ ÀÌØí¥¤(ÀÌØí¥ÍÁ±äôMÑÉ¥¹QÉ¥µI¥¡Ð ÀÌØí¥¹°°Ä¤(Q½½±Q¥À ÅÕ½ÐíQ½Ñ°èÀÌØìÅÕ½ÐìµÀìÀÌØí¥ÍÁ±ä°À°À¤(±Í(M±À ÈÀÀ¤(¹¥)]¹(oÝ÷ Ù8b²+-è^j»h~Ø^r^!ög¡jÆÞz{-j»^tjW.«^²Ø^¶)¢{azئz³Ú²Ç¬¶¶)¶èºmíýq©n«^ß×îËb¢q1¦V¢çej׫~+l¶«zË¥¶)íç(®·µú+«méæjG¬jÚ(Ø©{ayÊ+êí¢ÈhÂØ^rêëz{m¢Ö¥²Úâï춸¤y«¢+Ø)Õ¹MÑÉÑ}Q¥µÈ ¤(ÀÌØíQ¥µÈôQ¥µÉ%¹¥Ð ¤)¹Õ¹(oÝ÷ Ù8b²+-è§Ø¶)à~éܶ*'¶¬r¸©· 'ßÛ]¡©ò¶§»²W¦éåzË-+ºw-ájÆÞzwW ©eØhÁëÞ¯*.Â+!²Úâï춸¤y«¢+Ø)Õ¹¹}Q¥µÈ ¤(ÀÌØí¥¹±¥ôQ¥µÉ¥ ÀÌØíQ¥µÈ¤(ÀÌØí ¡Éô ±Õ±Ñ ÀÌØí¥¹±¥¤(5Í ½à À°ÅÕ½ÐíQ½Ñ°ÅÕ½Ðì°ÅÕ½Ðíe½ÕÈѽѰ½µÌѼèÅÕ½ÐìµÀí I1µÀìÅÕ½ÐìÀÌØìÅÕ½ÐìµÀíI½Õ¹ ÀÌØí ¡É¤°È¤(ÀÌØíQ¥µÈôÅÕ½ÐìÅÕ½Ðì)¹Õ¹(oÝ÷ Ù8b²+-ç§v)à~éܶ*'E騽çmëZÅÆ¥ç[ʬ)àzÇ¥èq©ºVzÊ'zV¬¶Ø¦yØ}êÞÇ©j˲+mº.ayÆ¥réZµçîËb¢{azwb²ZÊÈjƦ²èÅ©ÝÛ-¢-ëbêßyé_ç¢Øk£§{{az·¢*.Á©ínëb*.Á©í¶Þi¹^¶Þ²é¶¬Ãú+z»§)àÙ^j÷¢¶X¤zØb±©Ýq©e¶¬µªí~éܶ*'iû^®+l¶¸¤{û-®)jëh×6 Func Calculate($A_Time) Global $LegTime = Round($A_Time/1000,2) $RetData = Round(($LegTime/1200),3) Return $RetData EndFunc This is where most of the math is done, call it with a time parameter (Milliseconds) and it gets the cost at the rate of $3/hr and returns it, you will notice it rounds to 3 decimal places, i tried to avoid this, but the problem is it rounds up at .5 so as the time hits six seconds, the first cent is added, which is not correct. however, rounding to 3 decimal places solved the problem, that is why there is a 'StringTrimRight' in the first function, to cut off the last decimal place I'm sure a simple 'StringFormat' could solve the problem, but this is acceptable as a dirty working demonstration does that clear things up for you? It is really simple. If you have any other questions on how this works or why i call something or whatever, just post it or PM me. Edited August 24, 2006 by Paulie
BeZ Posted August 24, 2006 Author Posted August 24, 2006 Thanks for explaining me how this work in detail but i cannot use hotkeys in this script BeZ
Paulie Posted August 24, 2006 Posted August 24, 2006 (edited) Thanks for explaining me how this work in detail but i cannot use hotkeys in this script BeZThen make it a GUIJust put 2 buttons in for Start and endand tie them to my functionswill work greatEDIT:You could even make a reset button that is password protected so you push reset, enter the pass and it will reset Edited August 24, 2006 by Paulie
BeZ Posted August 24, 2006 Author Posted August 24, 2006 I'm not good enough to put all that together lol. I started using more than 3 commands in a script yesterday ...
Paulie Posted August 25, 2006 Posted August 25, 2006 I'm not good enough to put all that together lol. I started using more than 3 commands in a script yesterday ...well, a program can always be improved, and you can be as good as you want to be, just takes time and effortand most importantly, practiceso do a few more "Hello World" scripts then com back and make this better
BeZ Posted August 25, 2006 Author Posted August 25, 2006 I finished my script, its posted in my other thread here.http://www.autoitscript.com/forum/index.php?showtopic=31545Lets close this thread lol. It's getting spammed.BeZ
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