Jump to content

Recommended Posts

Posted

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)
Posted (edited)

#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
Posted

#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.

Posted

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

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

 

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
  • Recently Browsing   0 members

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