Jump to content

Recommended Posts

The issue I'm having seems relatively straight forward, but I've run into an issue an I wonder if there is a work around. 

 

If I run the code below I get : ==> Variable cannot be accessed in this manner.:

#include <Date.au3>

$sDateTime = "2016/01/31 23:00:00"

$sDateTime2 = _DateAdd('d', 1, $sDateTime())

MsgBox($MB_SYSTEMMODAL, "", "Date: " & $sDateTime2)

 

If I run the code below it works.

#include <Date.au3>

$sDateTime2 = _DateAdd('d', 1, "2016/01/31 23:00:00"())

MsgBox($MB_SYSTEMMODAL, "", "Date: " & $sDateTime2)

Is there a work around for this? I want to take a date that is stored in a variable from earlier in the script and add a day to it.

Edited by noobieautolearn
Link to post
Share on other sites
  • Moderators

Your first one will work if you take the () out after $sDateTime. It is a variable, not a function.

"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 post
Share on other sites
40 minutes ago, JLogan3o13 said:

Your first one will work if you take the () out after $sDateTime. It is a variable, not a function.

Interesting, thank you very much that worked, I appreciate it.  Why then does it work when you have the () after the date and time in the second example?

Link to post
Share on other sites
  • Moderators

Your second example did not work for me, until I took the () out. What version of AutoIt, and what version of Windows, are you using?

"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 post
Share on other sites
17 hours ago, JLogan3o13 said:

Your second example did not work for me, until I took the () out. What version of AutoIt, and what version of Windows, are you using?

That is strange, I got it to work running by running it in SciTE-Lite go using the tools then go option. I have SciTE-Lite version Version 3.5.4 .

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

    No registered users viewing this page.

×
×
  • Create New...