AutoHotKey Script: SyncDialogPath

; Win+O: Synchronize current path from Explorer to Open/Save Dialog

#o::
IfWinExist, ahk_class CabinetWClass
{
	ControlGetText, _path, ToolbarWindow322
	_path := SubStr(_path, 10)
	IfWinExist, ahk_class #32770
	{
		ControlGetText, _text, ToolbarWindow322
		if ErrorLevel
		{
			ControlFocus, Edit1
			ControlSetText, Edit1, %_path%
			ControlSend, Edit1, {Enter}
		}
		else if _text
		{
			ControlFocus, ToolbarWindow322
			ControlSend, ToolbarWindow322, {Space}
			ControlSetText, Edit2, %_path%
			ControlSend, Edit2, {Enter}
		}
		else
		{
			ControlFocus, ToolbarWindow323
			ControlSend, ToolbarWindow323, {Space}
			ControlSetText, Edit2, %_path%
			ControlSend, Edit2, {Enter}
		}
	}
}
Return
Advertisements

About AyuanX

Big Brother is watching you! Yes, you!
This entry was posted in 個人用途 and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s