[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Using File Modified as a variable : Code Request

I'm having a surprising amount of trouble with this, I was able to do this all successfully in VBA, but just couldn't convert it to work in Visual Studio 2008. Ive since lost all my VBA work on the script and was hoping i could get some help from the forum.  

Basically I'm in search for a script that Loops the following 3 processes, i also need it to run from an .exe file or similar with no UI (User Interface) so it constantly runs in the background (This is all to go with a multimedia software):

if file 'c:\X.txt' has been modified equal to or more than 15 minutes ago, then send key R

if file 'c:\X.txt' has been modified equal to less than 5 minutes ago, then turn on numlock light, if not then turn off light.

if file 'c:\X.txt' has been not been modified for the last 4 hours , then send key delete file


Any help would be much appreciated, and i hope to be able to learn alot from this forum in the future.
0
kakashisharingun
Asked:
kakashisharingun
1 Solution
 
DhaestCommented:
Here some help for your timing


Dim fileName As String
fileName = "X.txt"

if DateDiff(DateInterval.Minute , Now, File.GetCreationTime(fileName)) > 240
   ' send delete file
elseif DateDiff(DateInterval.Minute , Now, File.GetCreationTime(fileName)) > 15
  ' send R-key
else
  ' send numlock ...
end if

Open in new window

0
 
LeDaoukCommented:
try to use AdvancedFileSystemWatcher to check the file changing issue and fire event after xx minutes
also use Process.Start("aaaa.exe") to run aaaa.exe file
 
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now