Solved

Visual Basic Code

Posted on 2011-02-22
5
225 Views
Last Modified: 2012-08-14
Was trying to figure this out for a while now - but cant at all.
Basically what i want to do is, using Visual Basic:

I want VB to analyze a specific file and, if that file has not been updated for the last 15 minutes, i want the R key to be pressed.

I also have another, similar thing i need to do which i cant figure out:

I want VB to analyze the same as the above file and, if that file has been updated within the last 5 minutes, i want the NUM lock to be toggled on

Sounds simple enough i know, but i, nor my google attempts, can figure it out
much appreciated to anyone who can help
0
Comment
Question by:kakashisharingun
  • 2
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
darbid73 earned 500 total points
ID: 34958499
1 if file has not been modified for 15 minutes

If DateDiff("n", FileDateTime("C:\Somefile.txt"), Now) > 15 Then
    MsgBox "Modified more than 15 minutes ago"
End If

Open in new window


You can change this around for Greater than or Less than 15

You could use the Sendkeys to press r

SendKeys "r"

Open in new window


You might find that the num lock is a little harder see here for how Microsoft suggests Toggle Num Lock
0
 
LVL 19

Expert Comment

by:darbid73
ID: 34958509
Also see here for NUM LOCK

FreeVBCode.com
0
 

Author Comment

by:kakashisharingun
ID: 35186981
I thaught i did accept their answer already
0
 

Author Comment

by:kakashisharingun
ID: 35186989
I am attempting to accept his solution now - but it doesn't appear to be letting me...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 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