Solved

Visual Basic Code

Posted on 2011-02-22
5
227 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 20

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 20

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

838 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