Solved

Visual Basic Code

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now