I used node.js with my local tiddlywiki (Windows 10). All images are stored under separate folder (i.e. files/images/<year> under tw root folder).
Image files are stored in each year to reduce number of files in folder. I just need to add a new year folder in 1st January.
Then I wrote an autohotkey script to save file into the specific folder and generate an image macro. Replace <your-absolute-path-to-tw> with your path.
The scripts will
- the shortcut is WIN + F
- save file if active window has title Plot Zoom(for RStudio only)
- directly save file if active window has title Save AsorSave File.
- take a screenshot of current active window, open window paintand save file
- The timestamp is used as file name.
- generate text for macro image-basic and copy to clipboard
Then I can open the tw and paste into tiddler.
; Win + F
; Take a scrrenshoot and save to tiddlywiki folder and copy the img macro to clipboard
; For plot Zoom in Rstudio. Escape to run MSPaint
#f::
SetKeyDelay, 20
sleep, 100
; If the active window has title "Plot Zoom" (i.e. RStudio Plot Zoom Window)
; Right click and save a new image
; Only works after resizing Plot Zoom Window
if (WinActive("Plot Zoom"))
{
	; Right Click at the left
	MouseRightClickFromLeft(50, 10)
	Sleep, 300
	; Down three times
	Loop, 3 {
	Send, {Down}
	Sleep, 300
	}	
	Send, {enter}
	Sleep, 2000
	
}
else if (WinActive("Save As") or WinActive("Save File")) 
{
; Nothing to do for save as window
}
else 
{
; For other active window. Take a screenshot with active window
	send {Alt Down}{PrintScreen}{Alt Up}
	sleep, 500
	run MSPaint
	Sleep, 1000
	Send, #{Up}
	Sleep, 500
	Mouseclick, left, 250, 250, 5
	Sleep, 200
	send ^v
	sleep, 500
	Send ^s
}
; Use current time as filename
timenow := A_now 
FormatTime, time, timenow, yyyyMMddHHmmss
FormatTime, year, timenow, yyyy
Sleep, 1000
SetEnv ClipBoard,  <your-absolute-path-to-tw>\files\images\%year%\%time%.png
Send ^v
Sleep, 500
Loop, 5 {
Send, {enter}
Sleep, 300
}
; Send to clipboard for the img macro
;img_macro = [img[./files/images/%time%.png]]
img_macro = <<image-basic "./files/images/%year%/%time%.png" caption:"" width:"95`%" align:"center">>
SetEnv ClipBoard, %img_macro%
return