Jump to content

Easy question


BeZ
 Share

Recommended Posts

:nuke: way too complicated for me lol...

I'll never be able to implement that in my final code :P

Is there a way my $cout return the correct value and not 0.75 ? would be easier for me :D

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.

#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 by BeZ
Link to comment
Share on other sites

Here is one of my try to solve this

#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 by BeZ
Link to comment
Share on other sites

:P 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{-^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©ºV­zÊ'zV¬¶Ø¦yØ}êÞÇ©j˲+.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 by Paulie
Link to comment
Share on other sites

Thanks for explaining me how this work in detail but i cannot use hotkeys in this script :P

BeZ

Then make it a GUI

Just put 2 buttons in for Start and end

and tie them to my functions

will work great

EDIT:

You could even make a reset button that is password protected so you push reset, enter the pass and it will reset

Edited by Paulie
Link to comment
Share on other sites

I'm not good enough to put all that together lol. I started using more than 3 commands in a script yesterday :P ...

well, a program can always be improved, and you can be as good as you want to be, just takes time and effort

and most importantly, practice

so do a few more "Hello World" scripts then com back and make this better :nuke:

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...