Solved

Using File Modified as a variable : Code Request

Posted on 2011-03-22
2
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 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