Posts Tagged ‘windows’

h1

An Improved Template System for Evernote

14/03/2010

This post has now been migrated to ThoughtAsylum.com.

Follow this link to go directly to the article.

h1

Scan to Evernote (without Fujitsu ScanSnap)

16/01/2010

This post has now been migrated to ThoughtAsylum.com.

Follow this link to go directly to the article.

h1

DropBox Freezes Out Explorer

05/08/2009

I’ve been using DropBox for some time now and I use it in some ways that I think are quite innovative and will be the subject of future blog posts.  However in the last few days I’ve been having a few problems with Windows Explorer taking forever (well over a minute or two at times) to respond and it responds very sluggishly.  I’ve managed to track the problem down to DropBox misbehaving.

I’m running version 0.6.507.0 as I have been for some time, but something somewhere has started causing these little fits.  The solution is simple.  Bring up task manager, find the dropbox.exe process and kill it.  Then navigate to the start up programs on the Windows start menu and start Dropbox.

Actually whilst that’s simple it all seemed a bit too much of a hassle for lazy me so I wrote a little script to do it.

Option Explicit
Const DROPBOX_FOLDER = "C:\Program Files\Dropbox\"
Const DROPBOX_EXE = "Dropbox.exe"

KillProcess(DROPBOX_EXE)
StartApplication(DROPBOX_FOLDER & DROPBOX_EXE)

Sub KillProcess(p_strProcess)
 Dim objService, objProcess
 Dim colProcesses
 Dim strProcessKill

 Set objService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

 Set colProcesses = objService.ExecQuery("Select * from Win32_Process Where Name = '" & p_strProcess & "'")
 For Each objProcess in colProcesses
 objProcess.Terminate()
 Next
End Sub

Sub StartApplication(p_strAppPath)
 Dim objShell
 Set objShell = WScript.CreateObject( "WScript.Shell" )
 objShell.Run("""" & p_strAppPath & """")
End Sub

Pop a shortcut to the script on your desktop and you should be able to access it quick enough – or even quicker if you set a shortcut key combination on it.

The script uses a couple of fairly standard little routines.  One kills the process and the other starts the application.  If you happen to have DropBox installed in an unusual location (mine is in the default), then just amend the first constant.

You may see two icons

You may see two icons

NB: You’ll probably notice that after the script ruins you’ll have two DropBox icons in your system tray.  If you move your mouse pointer over the two icons the one for the now terminated process will disappear.

h1

Presentations – Keeping your screen active

20/07/2009

Power saving options on computers are something that I personally think are great.  They not only help reduce carbon footprints, but they also help draw out even more life from your laptop battery.   One of the main ways in which this is done (others being things such as disabling hardware) is by having an inactivity option that turns off the screen and the hard disk after a period of inactivity.  Unfortunately there are times when this isn’t something you want.  The primary example of this is when you are giving a presentation.

The typical way of overriding this in Windows is to change what power saving scheme is being used through the Windows control panel or a third party application that links directly to these options.  However sometimes end users don’t have access to this.

This typically occurs where a group policy has been applied to stop users ‘tinkering’ with the power saving schemes.  Users with access can amend or delete power saving schemes which can lead to complications with machines and so it is not that uncommon to restrict access.

Whilst applications such as Microsoft PowerPoint can lead the OS into knowing that it should keep things like monitors on if a presentation is in a browser or some other “power unaware” application, then power saving actions can kick in.

I decided to apply a brute force solution to this by creating an AutoHotKey script to send a key press to the OS at regular intervals.  By default it sends a Shift key press as this is least likely to have any impact on any application, but this can be modified along with the frequency with which it is sent by the use of a settings file.  The settings file also includes an option to choose whether to start sending key presses as soon as it is run.

The code for the script is given at the end of this post, but I have also compiled this into a stand alone executable that you could even pop onto your flash drive if you’re going to be presenting on someone else’s PC.  Similarly you could add it into your start-up group (with it set not to auto start sending key presses) so it is always there when you need it.

The script places a monitor icon in the system tray.  When it is black power saving actions through inactivity will take place.  When it is blue, key presses will be sent.  Right clicking on the icon will display a menu with an override option.  Selecting this option will place a check mark next to it which will set the icon blue and initiate the override mode.  Selecting the option again will uncheck it, set the icon black and turn off the override mode.

Only one setting is available on the settings menu.  This is another check item and determines whether override mode should be enabled immediately when the utility is first started.

The utility looks for a settings file called ActiveDisplay.ini in the folder from which the utility is being run.  If it does not exist, the utility will use its default settings which match the settings given in this example file:

[Settings]
;Set to 1 to enable override mode at start-up and 0 to disable.
EnableOnRun=0
;Specify what characters should be sent.  Use {} for special key strokes
KeyStroke={SHIFT}
;Number of milliseconds between sending the key strokes (120,000 milliseconds : 2 minutes)
Period=120000

If you want to tweak the script to meet your own needs you can get the details below and use your own icons.  If you want to get the compiled version you can download it for free.

#Persistent
#SingleInstance

;Read in settings
iniread, EnableAtStartup, %A_ScriptDir%\ActiveDisplay.ini, Settings, EnableOnRun, 0
iniread, KeyStroke, %A_ScriptDir%\ActiveDisplay.ini, Settings, KeyStroke, {Shift}
iniread, Period, %A_ScriptDir%\ActiveDisplay.ini, Settings, Period, 120000

;Create the tray menu
menu, tray, add, Override, Override
Menu, SettingsMenu, add, EnabledAtStartup
Menu, tray, add, Settings, :SettingsMenu
menu, tray, add, About
menu, tray, add, Exit
menu, tray, nostandard

;Initialise
;Time to do something that seems crazy - we'll flip these and then call the menu selection routines where it will get flipped back
EnableTimer := EnableAtStartup
EnableAtStartup := Not(EnableAtStartup)
GoSub, EnabledAtStartup
EnableTimer := Not(EnableTimer)
GoSub, Override
return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

SendKeyStroke:
Send %KeyStroke%
return

Override:
EnableTimer := Not(EnableTimer)
If EnableTimer
{
 menu, tray, Check, Override
 menu, tray, icon, C:\Icons\Monitor On.ico
 menu, tray, tip, Default Power Saving Mode Overridden
 SetTimer, SendKeyStroke, %Period%
}
Else
{
 menu, tray, UnCheck, Override
 menu, tray, icon, C:\Icons\Monitor Off.ico
 menu, tray, tip, Default Power Saving Mode
 SetTimer, SendKeyStroke, Off
}
return

EnabledAtStartup:
EnableAtStartup := Not(EnableAtStartup)
If EnableAtStartup
{
 menu, SettingsMenu, Check, EnabledAtStartup
 iniwrite, 1, %A_ScriptDir%\ActiveDisplay.ini, Settings, EnableOnRun
}
Else
{
 menu, SettingsMenu, UnCheck, EnabledAtStartup
 iniwrite, 0, %A_ScriptDir%\ActiveDisplay.ini, Settings, EnableOnRun
}
return

About:
MsgBox, 0, About Active Display, Version 1.0`nCopyright 2009 RebootIT`n`nhttps://flagit.wordpress.com
return

Exit:
ExitApp