Jump to content
RaiNote

Question Var Output

Recommended Posts

RaiNote

I have a question About the Output from a Var which looks like :     34.32132312321   

How to make it work that it looks like :      34.321

I already searched through some AutoIt Includes >.< I hope somebody can help by this

$Byte = InetGetSize(http://download853.mediafire.com/albf2b2g21bg/6tkd4gb68qdb7hd/Anime+Pics.rar,0);Download Size in Byte(Just an old Pic File)
    
    If $Byte > 1024 Then
        
    $Kilobyte = $Byte / 1024;Converting Byte to Kilobytes
        
        If $Kilobyte > 1024 Then
            
        $Megabyte = $Kilobyte / 1024;Converting Kilobyte to Megabyte
            
            If $Megabyte > 1024 Then
                
            $Gigabyte = $Megabyte / 1024;Converting Megabyte to Gigabyte
            
                If $Gigabyte > 1024 Then
                
                $Terabyte = $Gigabyte / 1024;Converting Gigabyte to Terabyte
                
                    If $Terabyte > 1024 Then
                    
                    $Petabyte = $Terabyte / 1024;Converting Terabyte to Petabyte
                    
                        If $Petabyte > 1024 Then
                            
                            $Exabyte = $Petabyte / 1024;Converting Petabyte to Exabyte
                            $_SIZE1 = $Exabyte & " EB"
                            
                        ElseIf $Petabyte < 1024 Then
                            
                            $Petabyte = $Terabyte / 1024
                            $_SIZE1 = $Petabyte & " PB"
                            
                        EndIf
                        
                    ElseIf $Terabyte < 1024 Then
                    
                    $Terabyte = $Gigabyte / 1024
                    $_SIZE1 = $Terabyte & " TB"
                    
                    EndIf
                
                ElseIf $Gigabyte < 1024 Then
                
                $Gigabyte = $Megabyte / 1024
                $_SIZE1 = $Gigabyte & " GB"
                
                EndIf
                
            ElseIf $Megabyte < 1024 Then
                
            $Megabyte = $Kilobyte / 1024
            $_SIZE1 = $Megabyte & " MB"
                
            EndIf
            
        ElseIf $Kilobyte < 1024 Then
            
        $Kilobyte = $Byte / 1024
        $_SIZE1 = $Kilobyte & " KB"
            
        EndIf
        
    ElseIf $Byte < 1024 Then
    
    $_SIZE1 = $Byte & " Bytes"
    
EndIf

MsgBox(52,"Title","Size is: " & $_SIZE1)

 


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
water

So you just want to strip off the exceeding decimal places?
Or should 34.32152312321 be rounded to 34.322?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RaiNote

Be rounded would be the best ^-^


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
water

Then please have a look at function Round.

ConsoleWrite(Round(34.32152312321, 3) & @CRLF)

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
JLogan3o13

Use the Round function, and specify the number of decimal places

$Num = 34.32152312321
ConsoleWrite(Round($Num, 3) & @CRLF)

 

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
RaiNote

Thx^^ u 2 :3

 


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
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

  • Similar Content

    • nacerbaaziz
      By nacerbaaziz
      Hi guys
      I'm looking for how to detect if the default audio output has changed
      During my research I found this file
      I did not know how to use it
      can  anyone guide me how  it works please.
      Thanks in advance
      audioOutputIsChanged.au3
    • way1000
      By way1000
      i'm trying to create a program that let's the user type a word in an input field (gui) and when a button is pressed the letters of the word are replaced by 1 word each from a list of words in a text file
      i created the gui for it but i need help to add some more code to make it work like intented

      each letter of a word should be replaced by a word from a text file
      the text file is a source for replacing letters is a file with 2 columns separated by tab that contains the entire alphabet (26 rows)
       
      please help if possible
       
      i posted an example gui screenshot

    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an urgent problem and we hope you can help me
      I want to detect if the audio output of the device has changed
      Such as the headset is connected or disConnected.
      or change the default audio output
      Is this possible?
      I really searched a lot and found suggestions but unfortunately I did not understand them
      Please explain to me
      Greetings
    • algiuxas
      By algiuxas
      Hello,
      I'm making program(using AutoIt) that would connect to server.
      I need help converting numbers to VarInt.

      About VarInt:



      About VarInt: https://developers.google.com/protocol-buffers/docs/encoding#varints
      I can't understand how VarInt works, maybe somebody could help me? Thanks
    • RaiNote
      By RaiNote
      Hi ^^,
      Just a little list of question:
      1. How to make an Var which defines everything like ' * ' Var of Windows
      2. How to add The Var(1.) within the a ComboBox or In the Menu
      3. How to load simply an *.au3 File wich adding a GUI and to the Main GUI a Button
      4. Using XML Files instead of 3. (I know the XMLDom or how it was named but Include file isn't anymore on my side avaible)
      5. Progressbar which is attached to Loading the File of 3./4.
      Thanks to everyone who helps :3
×