Jump to content
Sign in to follow this  
Morghel

Suggestions needed for a function

Recommended Posts

Hello! 

I'm having troubles with this function I made.

Func CancellaOrdini()
   Local $file = FileOpen("OTps Trend.csv", 1)
   $time = @HOUR & ":" & @MIN & ":" & @SEC & "." & @MSEC
    ToolTip("Cancella Tutti gli Ordini", 125, 0)
    FileWrite($file, $date)
    FileWrite($file, ",")
    FileWrite($file, $time)
    FileWrite($file, ",")
    FileWrite($file, "0")
    FileWrite($file, ",")
    FileWrite($file, "1" & @CRLF)
    FileClose($file)
 EndFunc   ;==>Cancella tutti gli Ordini

What it does:

when I press a key on the keyboard It opens a csv file and adds a time stamp with some other values and it closes the file right after.

This csv is then read by another program.

It works perfectly as it is but due to a bug in the program that needs this csv I need to add a 1sec to that timestamp.

How can I achieve that?

Thanks a lot for the help :D

Share this post


Link to post
Share on other sites

Not sure I'm understanding you. If you need just to add one second to your time, you can do this:

$timeplusone = @HOUR & ":" & @MIN & ":" & @SEC + 1 & "." & @MSEC



Otherwise, can you explain further what you try to accomplish?

Edited by JLogan3o13

Share this post


Link to post
Share on other sites

Maybe something like this?

#include <date.au3>

Func CancellaOrdini()
    Local $file = FileOpen("OTps Trend.csv", 1)
    $aDateTime = StringSplit(_DateAdd('s', 1, _NowCalc()), ' ')
    $date = $aDateTime[1]
    $time = $aDateTime[2] & '.' & @MSEC
    ToolTip("Cancella Tutti gli Ordini", 125, 0)
    FileWrite($file, $date & ',' & $time & ',0,1' & @CRLF)
    FileClose($file)
EndFunc   ;==>CancellaOrdini

Share this post


Link to post
Share on other sites

Something like this?

Func CancellaOrdini()
    Local $file = FileOpen("OTps Trend.csv", 1)
    $time = @HOUR & ":" & @MIN & ":" & @SEC + 1 & "." & @MSEC
    ToolTip("Cancella Tutti gli Ordini", 125, 0)
    FileWriteLine($file, $date & "," & $time & ",0,1")
    FileClose($file)
 EndFunc   ;==>Cancella tutti gli Ordini

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

There seem to be a lot of people with spare time ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

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
Sign in to follow this  

×
×
  • Create New...