Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Scheduler Alternative, Self-mailer


  • Please log in to reply
No replies to this topic
Fruitmoose
  • Guests
  • Last active:
  • Joined: --
Hey there,

I'm just throwing some ideas on the table here: :-)
Posted Image

The idea is that you "mail letters" to yourself as reminders. There is a thing on the internet where you can email yourself in 10 years or something, this is kind of like that I guess. I use it to remind myself of little ideas I have that I want to keep in my mind... it can be used as an alternative to a scheduler, like "remind me in a week to pay my credit card bills"...

This is a virtual version I have of little reminders I write myself on post-it notes and throw in a box!


(I didn't want to have another script running all the time in the background, so the setup I have is that a script that is running very frequently checks the .ini file for the "Earliest" date and runs the ReadLetter script accordingly. I also put DeliverLetter in the "Send to" menu. )

Deliver Letter:
(You have to pass the file you want to send to this as a parameter, drag and drop, Send to menu, etc.)
CoordMode, Mouse, Screen
MouseGetPos, mX, mY
if mY>7
	mY -= 7
if mX>47
	mX -= 47
Gui, Color, Black
Gui, +AlwaysOnTop +LastFound
Gui, Font, S8 Bold, Lucida Console
Gui, Add, DateTime, x0 y10 w130 h20 vMyDateTime,
Gui, Add, Button, w0 h0 Default, Send
WinSet, Region, 2-0 h40 w126 R10-10
WinSet, Transparent, 150
Gui, -Caption
Gui, Show,x%mX% y%mY% w130 h40, Deliver
Return

ButtonSend:
Gui, Submit
Loop, %1%, 0, 0
{
	IniRead, MessageList, %A_ScriptDir%\DeliveryDates.ini, main, DeliveryDates
	if (MessageList = "ERROR" or !MessageList)
		MessageList = %MyDateTime%*%1%
	else
		MessageList = %MessageList%|%MyDateTime%*%1%
	Sort, MessageList, D|
	StringLeft, Date, MessageList, 14
	IniWrite, %Date%, %A_ScriptDir%\DeliveryDates.ini, main, Earliest
	IniWrite, %MessageList%, %A_ScriptDir%\DeliveryDates.ini, main, DeliveryDates
	if ErrorLevel = 1
		MsgBox, Letter Sending Failed
	Break
}
GuiEscape:
GuiClose:
ExitApp


ReadLetter
#SingleInstance, Ignore


IniRead, MessageList, %A_ScriptDir%\DeliveryDates.ini, main, DeliveryDates
Loop, Parse, MessageList, |
{
	if A_Index = 1
	{
		Length := StrLen(A_LoopField) + 1
		Loop, Parse, A_LoopField, *
		{
			if A_Index = 1
				Date := A_LoopField
			else if A_Index = 2
			{
				File := A_LoopField
				break
			}
		}
	}
	else if A_Index = 2
	{
		Loop, Parse, A_LoopField, *
		{
				Date2 := A_LoopField
				break
		}
		break
	}
}

if (!File or !Date)
	ExitApp
else if (A_Now > Date)
{
	;SoundPlay, %A_ScriptDir%\alert.wav
	Loop, %File%
		FileName := A_LoopFileName
	if (StrLen(FileName) > 14)
	{
		StringLeft, FileName, FileName, 11
		FileName = %FileName%...
	}
	Gui, +AlwaysOnTop +LastFound
	Gui, Color, Black
	Gui, Font, S8 CWhite, Lucida Console
	Gui, Add, Text, x5 y10 w100 h40 , --New letter--`n%FileName%
	Gui, Add, Button, x5 y60 w100 h20 Default, Read
	Gui, Add, Button, x5 y90 w100 h20 gHour, ...in an hour
	Gui, Add, Button, x5 y120 w100 h20 gDay , ...tomorrow
	WinSet, Region, 0-0 h150 w112 R10-10
	WinSet, Transparent, 150
	Gui, -Caption
	Gui, Show, x1150 y600 h150 w112, Delivery
}
else
	ExitApp
Return

ButtonRead:
	Run, "%File%",,UseErrorLevel
	if ErrorLevel
		MsgBox, Cannot open %File%.`nDeleting message.
	StringTrimLeft, MessageList, MessageList, %Length%
	IniWrite, %MessageList%, %A_ScriptDir%\DeliveryDates.ini, main, DeliveryDates
	if MessageList
	{
		StringLeft, Date, MessageList, 14
		IniWrite, %Date% ,%A_ScriptDir%\DeliveryDates.ini, main, Earliest
	}
	else
		IniWrite, %A_Space%,%A_ScriptDir%\DeliveryDates.ini, main, Earliest
ExitApp

Day:
	NewDate := A_Now
	NewDate += 1, days
	Goto, SetDate
Hour:
	NewDate := A_Now
	NewDate += 1, hours
SetDate:
	StringTrimLeft, MessageList, MessageList, 14
	MessageList =%NewDate%%MessageList%
	Sort, MessageList, D|
	StringLeft, Date, MessageList, 14
	IniWrite, %MessageList%, %A_ScriptDir%\DeliveryDates.ini, main, DeliveryDates
	IniWrite, %Date% ,%A_ScriptDir%\DeliveryDates.ini, main, Earliest
	if ErrorLevel = 1
		MsgBox, Failed to Update Letter Queue
ExitApp

GuiClose:
GuiEscape:
ExitApp