Solved

Using File Modified as a variable : Code Request

Posted on 2011-03-22
2
176 Views
Last Modified: 2012-05-11
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
Comment
Question by:kakashisharingun
2 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 35187041
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
 
LVL 4

Expert Comment

by:LeDaouk
ID: 35187132
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question