Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Create desktop folders from anywhere (w/ tray icons and tooltips).


  • Please log in to reply
No replies to this topic
Lateralus138
  • Members
  • 3 posts
  • Last active: Feb 10 2016 05:20 PM
  • Joined: 20 Feb 2015

This is a simple script I created to create a desktop folder from anywhere with a hot key. 

 

I utilize Windows desktop as a temp workspace and I do a lot at one time and so when ideas for projects pop into my head or I remember something I need to do I will usually create a desktop folder to remind myself I have something to do. With this script I can create the folder from anywhere wihout having to minimize any windows. It provides timed tooltips and tray icons for all errors and successes; icons are loaded from imageres.dll, but of course, you can change all of that. All tray icons, tray text and tooltips change with each test state.

Input box provided to name folder.

 

Tray icon stuff was just fun for me being geeky so of course that can all be stripped, not a expert script I imagine, but it's useful to me, hope someone else gets use out of it.

; AHK script created by Lateralus138
; Create desktop folders with a hotkey
; Key Control+Shift+f (^+f)

; Tray icon function (just for fun),
; provide resource library name and 
; icon number and tray message.
TrayIcon(ResNam, ResNum, TrayMsg )
	{
		Menu, Tray, Icon, %ResNam%, %ResNum%
		Menu, TRAY, Tip, %TrayMsg%
	}


; Tooltip w/timer function, provide
; text and time.
tttimer(tttext, tttime)
	{
		ToolTip, %tttext%
		Sleep, %tttime%
		ToolTip
	}
	
; Current users desktop location.
DeskDir := USERPROFILE . "\Desktop\"

; Initially call main tray icon
Gosub, TrayIconSub

; Start hotkey, main program funtion.

; Change hotkey in the line below.
^+f::
TrayIcon("imageres.dll", 108, "Name your desktop folder.")
InputBox, FolderName, Desktop Folder Creator, Name your desktop folder`:,,300, 120
If ! FolderName
	{
		TrayIcon("imageres.dll", 80, "Folder name not set.")
		tttimer("Folder name not set.", 6000)
		Gosub, TrayIconSub
		Return 
	}
NewDir := DeskDir . FolderName
FileCreateDir, %NewDir%
If ! NewDir
	{
		TrayIcon("imageres.dll", 80, "Bad news!")
		tttimer("Something went wrong, Folder`:`n" """" . NewDir . """" "`ndoes not exist.",10000 )
		Gosub, TrayIconSub
		Return 
	}
TrayIcon("imageres.dll", 77, "Folder created!")
tttimer("Folder`:`n" """" . NewDir . """" "`ncreated successfully!.",6000)
Gosub, TrayIconSub
Return

; Resets tray icon folder icon
TrayIconSub:
TrayIcon("imageres.dll", 108, "Desktop Folder Creator")
Return