But pressing F2 won't do the same thing although I'm passing the same integer (8) to Explore method.
Why?
Using Round(o.Folder) instead of o.Folder solves the problem, but I would like to hear explanation why do I have to do that... Rounding 8 to 8 sounds funny but it makes it work...
Code: Select all
;===Hotkeys=============================================================================
F1::ComObjCreate("Shell.Application").Explore(8) ; explores user's most recently used documents
F2::
Options=
(
Folder: 8
Color: red
Sounds: no
)
o := GetOptions(Options)
ToolTip % o.Folder ; result: 8
ComObjCreate("Shell.Application").Explore(o.Folder) ; doesn't work
;ComObjCreate("Shell.Application").Explore(Round(o.Folder)) ; works
return
Esc::ExitApp
; ShellSpecialFolderConstants: http://msdn.microsoft.com/en-us/library/windows/desktop/bb774096%28v=vs.85%29.aspx
;===Functions===========================================================================
GetOptions(Text) {
Out := {} ; create Out object (associative array)
Loop, parse, Text, `n, `r ; parse, find first ":" sign, and assign key = value in Out object
{
Line := Trim(A_LoopField), pos := InStr(Line, ":")
if (pos > 1) ; 0 is not found + key must have at least one letter
key := Trim(SubStr(Line, 1, pos-1)), Value := Trim(SubStr(Line, pos+1)), Out.Insert(key,value)
}
return Out
}