Sign in to follow this  
Followers 0
dewild1

simple for you, I have been at it all day, can not read any more,plz

8 posts in this topic

Hi, I am used to AHK and I have spent an hour or two on just this, so please throw me a bone.. :)

OK, trying to get a the current minute + 30 seconds to a variable to go into a line of code to be run in dos... Just like the example in help, but I added "$VAR" to guess,,,(I hope I am right)LOL ,

Run(@ComSpec & " /c " & 'commandName$VAR', "", @SW_HIDE)

Anyways, here is what I am having trouble with, got the below code to add 30 sec, but I can not figure out this stuff.. MsgBox(0,$x,$MyTime[$x]) and I plan on switching the correct one for the $VAR above...

#include <Date.au3>



$sNewDate = _DateAdd( 's',30, _NowCalc())

MsgBox( 4096, "", "Date: " & $sNewDate )

Dim $MyDate
Dim $MyTime
_DateTimeSplit($sNewDate,$MyDate,$MyTime)


For $x = 1 to $MyTime[0]
    [b]MsgBox(0,$x,$MyTime[$x])[/b]
Next

Thank you, first impressions are I like it. ;)

Share this post


Link to post
Share on other sites

Hi,

Welcome to the forums :)

First off,

This is how you should run the DOS command.

Run(@ComSpec & " /c " & $VAR, "", @SW_HIDE)

Command$var, isn't something that will do anything in CMD... ;) Also, you cannot call varibles in strings with the current way you are doing it. You could like:

Opt ("ExpandVarStrings", 1)
$VAR = "Netstat -a"
Run(@ComSpec & " /c $VAR$", "", @SW_HIDE)

MsgBox (0, "", "$var$")

It is way eaiser to just do that the first way mentioned.

Now for the last part, it appears you are calling the wrong varible? I'm not sure, but thats what it appears to be... :P

It should be:

#include <Date.au3>

$sNewDate = _DateAdd('s', 30, _NowCalc())

MsgBox(4096, "", "Date: " & $sNewDate)

Dim $MyDate
Dim $MyTime
_DateTimeSplit($sNewDate, $MyDate, $MyTime)

For $x = 1 To $MyDate[0]
    MsgBox(0, $x, $MyDate[$x])
Next

Share this post


Link to post
Share on other sites

isn't it "_RunDos"??


tolle indicium

Share this post


Link to post
Share on other sites

Heya, welcome to AutoIt.

Try taking a gander at the macros. Current time is found as such:

Msgbox(0,"",@MON & "/" & @MDAY & "/" & @YEAR & @LF & @HOUR & ":" & @MIN & ":" & @SEC)

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Encapsulate the entire string in single quotes and you won't have to use double-double quotes within it.

Run('schtasks.exe /create /sc once /ru system /tn somename /Tr "c:\program files\911 pc fix . com\utils1\blabla.exe" /st ' & $var, "", @SW_MAXIMIZE)

Edited by weaponx

Share this post


Link to post
Share on other sites

Don't hate programming, love programming. It's a much more gratifying teacher of patience than children.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

I know, it can be fun to make things... But I would rather go out and play!

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