ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

AHK Help anyone?

<< < (6/7) > >>

ak_:
Here's how i would do it :

--- ---Activate:
Loop %ProgramFiles%\Dr. Windows\*.exe
{
  FileList = %A_LoopFileLongPath%`n%FileList%
}
StringSplit File, FileList, `n
random rnd, 1, %File0%
fileToRun = File%rnd%
fileToRun := %fileToRun%
Run %fileToRun%
Maybe there's a simpler solution but it works.

wreckedcarzz:
OK cool, I will give it a go and see what happens. Thanks a lot, this was really getting annoying getting irrelevant search results  :)

ak_:
You're welcome :)

By the way, i found out that this has the same result and takes less code :

--- ---Loop %ProgramFiles%\Dr. Windows\*.exe
{
  FileList = %A_LoopFileLongPath%`n%FileList%
}
StringSplit File, FileList, `n
random rnd, 1, %File0%
Run % File%rnd%
I didn't know about this "% " thing and it's very convenient.

wreckedcarzz:
New problem! :(

Ok, so here is what I am trying to do (as simply explained as possible):

I need a script to be able to check the date that a file was CREATED. I think I got this part down...

--- ---FileGetTime, TimeToFix, fixschedule.txt, C
Return

But here is the problem- How do I make the script do X after Y amount of time has passed? I thought about it for a while and still don't get it. :read: Variables aren't my thing :)

ex:

--- ---If %TimeToFix% > amount of time (week?)
Run myjunk.exe
else
Return

Does anyone understand? Am I just talking to the wall, and no one knows where I am coming from or what I am trying to do? Can anyone give any ideas? :tellme:

Thanks in advance,
-Brandon

lanux128:
try without enclosing the variable in quotes, also you need to define formatting for TimeToFix since FileGetTime returns the date in this format: YYYYMMDDHH24MISS

Note: Date-time values can be compared, added to, or subtracted from via EnvAdd and EnvSub. Also, it is best to not use greater-than or less-than to compare times unless they are both the same string length. This is because they would be compared as numbers; for example, 20040201 is always numerically less (but chronologically greater) than 200401010533. So instead use EnvSub to find out whether the amount of time between them is positive or negative.-Autohotkey.chm
--- End quote ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version