Sign in to follow this  
Followers 0
Morghel

Suggestions needed for a function

7 posts in this topic

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



#2 ·  Posted (edited)

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!

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

Three working answers in less than two minutes, what other forum can say that! :)

1 person likes this

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

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

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  
Followers 0