Jump to content
Sign in to follow this  
13lack13lade

send time issues

Recommended Posts

Hey guys,

I have a script that currently uses nowcalcdate to give me today and yesterdays date.. in the current format e.g 020314 ddmmyy and worked fine however now it is sending 2014/03/02

Need it to be fixed to return values in ddmmyy format and im not sure whats happened for it to suddenly change how it is sent..

Func _Convert($date)
         Return StringRegExpReplace($date, '\d\d(\d\d)/(\d\d)/(\d\d)', '$3$2$1')
      EndFunc
      $today = _NowCalcDate()
      $yesterday = _DateAdd('d', -1, $today)

Share this post


Link to post
Share on other sites

#include <date.au3>
#Include<file.au3>
#include<ie.au3>
;date function & variable
      Func _Convert($date)
         Return StringRegExpReplace($date, '\d\d(\d\d)/(\d\d)/(\d\d)', '$3$2$1')
      
      $today = _NowCalcDate()
      $yesterday = _DateAdd('d', -1, $today)
      EndFunc
;open calypso & login
Run("C:\Program Files\InterSoft International, Inc\NetTerm\netterm.exe")
Sleep(4000)
Send("{ENTER}")
Sleep(2000)
Send("username")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
Send("password")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
Send("ras")
Sleep(700)
Send("{ENTER}")
Sleep(700)
Send("k_arabian")
Sleep(700)
Send("{ENTER}")
Sleep(700)
Send("*")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("*")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("*")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("*")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("H")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("dxb")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("ara")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("*")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("*")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send($yesterday)
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send($today)
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send($today)
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("311014")
Sleep(500)
Send("{ENTER}")

There is some more of the script... i just need $yesterday to be yesterdays date to be sent in ddmmyy format and $today to send todays date in ddmmyy format.. it worked absolutely fine then one day just broke..so im not sure whats happened :( guessing the function is what is used to change from yyyymmdd to ddmmyy as someone on the forum previously helped me but i cant seem to find it.

Found my previous post 

However that is the exact code im using and for some reason its not changing the format...

Edited by 13lack13lade

Share this post


Link to post
Share on other sites

#include <date.au3>

$today = _NowCalcDate()
MsgBox(0,"Today", _Convert($today))
$yesterday = _DateAdd('d', -1, $today)
MsgBox(0,"Yesterday", _Convert($yesterday))

Func _Convert($date)
    Return StringRegExpReplace($date, '\d\d(\d\d)/(\d\d)/(\d\d)', '$3$2$1')
EndFunc   ;==>_Convert


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

To make your script more reliable I suggest to replace Send with ControlSend.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-30 - Version 1.6.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - 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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...