Jump to content
Sign in to follow this  
Morghel

Suggestions needed for a function

Recommended Posts

Morghel

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
JLogan3o13

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

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

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
DW1

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
water

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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - 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
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

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


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - 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
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Morghel

Thanks a lot for the help guys <3

I will test out every solution and get back to you.

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  

×