Jump to content

Can someone check my maths....


 Share

Recommended Posts

Can someone please let me know if I have this is correct - I've sort of tested it and it seems to work but I need a second opinion.

I'm hoping someone will agree that it will only call the RUN line if the size is over 20 gig ?

$mail_que = FileGetSize('C:\Program Files\Microsoft\Exchange Server\TransportRoles\data\Queue\mail.que')
$mail_que = $mail_que / 1024
If $mail_que > 20000000 Then
Run('c:\matt\mail_que_email_alert.exe', 'c:\matt')
EndIf
Exit
Link to comment
Share on other sites

FileGetSize returns Bytes so your calculation is somehow correct. To get more precise results you should either use 1000 or 1024 for your calculations.

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

You can just do that:

$File = FileGetSize('C:\Program Files\Microsoft\Exchange Server\TransportRoles\data\Queue\mail.que') / 1073741824

If $File > 20 Then
    Run('c:\matt\mail_que_email_alert.exe', 'c:\matt')
EndIf

Exit

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

@MattX

A byte is 8 bits, a kilobyte is 1024 bytes. That's why I try to use the suffix with a "i" for the computer sizes such as kib, mib etc.

Local $iMailqueSize = FileGetSize('C:\Program Files\Microsoft\Exchange Server\TransportRoles\data\Queue\mail.que')

If $iMailqueSize > 1024 * 1024 * 1024 * 20 Then ;1 kilo -> 1 mega -> 1 giga * 20 = 20 Gio
;1 * 1024 * 1024 * 1024 * 20 ; 1 byte -> 1 kilo etc.
    Run('c:\matt\mail_que_email_alert.exe', 'c:\matt')
EndIf

Edit: You understood that the size unity step is *1024.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

I - and I'm sure that's true for the rest of us - are glad to be of service :D

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

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

×
×
  • Create New...