Jump to content

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

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...