e$B=uED$G$9!#e(B
On Tue, May 25, 2010 at 04:25:13PM +0900, Usaku NAKAMURA wrote:
e$BD>A0$Ne(BInvokeVerbe$B$,<:GT$7$F$k$s$@$m$&$H$O;W$&$s$G$9$,!"860x$rD4::$9$k$K$Oe(B
e$B2?$r$9$l$P$$$$$G$9$+!)e(B
e$B$4Js9p$"$j$,$H$&$4$6$$$^$9!#e(B
e$B0J2<$K5-:$7$?%9%/%j%W%H$N<B9T7k2L$r65$($F$$$?$@$1$^$9$+!)e(B
e$B4|BT$7$F$$$k7k2L$O!"e(B
(1) e$B%+%l%s%H%G%#%l%/%H%j$Ke(B test.txt e$B$,$G$-$F$$$k!#e(B
(2) test.txt e$B$X$N%7%g!<%H%+%C%H$,e(B2e$B$D$G$-$F$$$k!#e(B
(3) e$B!V%7%g!<%H%+%C%H$N:[email protected](B(&S)e$B!W$H=PNO$5$l$k!#e(B
e$B$G$9!#e(B
-- encoding:Windows-31J --
require ‘win32ole’
WIN32OLE.codepage = 932
fso = WIN32OLE.new(‘Scripting.FileSystemObject’)
cfolder = fso.getFolder(".")
f = cfolder.CreateTextFile(“test.txt”)
f.close
shell = WIN32OLE.new(‘Shell.Application’)
nsp = shell.namespace(cfolder.path)
fi = nsp.parseName(“test.txt”)
shortcut = fi.verbs.each.collect{|verb|
verb.name
}.find {|name|
name.unpack(“C*”) == [
131, 86, 131, 135, 129, 91, 131, 103, 131, 74,
131, 98, 131, 103, 130, 204, 141, 236, 144, 172,
40, 38, 83, 41]
}
puts shortcut
arg = WIN32OLE_VARIANT.new(“e$B%7%g!<%H%+%C%H$N:[email protected](B(&S)”)
fi.InvokeVerb(arg)
arg = WIN32OLE_VARIANT.new(shortcut)
fi.InvokeVerb(arg)
- test_folderitem2_invokeverb.rb e$B$,2?$r$d$C$F$$$k$+!)e(B
e$B%F%9%H$O!"e(BInvokeVerbe$B$,!"e(BWin32OLE
e$B$G$b<B9T$G$-$k$3$H$r3NG’$7$F$$$^$9!#e(B
InvokeVerbe$B$O0z?t$rCMEO$7$K$9$kI,MW$,$"$j$^$9!#e(B
Win32OLEe$B$G$Oe(B
InvokeVerb(“e$B%7%g!<%H%+%C%H$N:[email protected](B(&S)”)
e$B$H$d$k$H;2>HEO$7$K$J$C$F$7$^$$!"%7%g!<%H%+%C%H$,$G$-$^$;$s!#e(B
e$B%F%9%H$G$O!"e(BWIN32OLE_VARIANT e$B$r;H$($P!“0z?t$Ne(B
e$BCMEO$7$,<B8=$G$-!”%7%g!<%H%+%C%H$,$G$-$k$3$H$r3NG’$7$F$$$^$9!#e(B
e$B=uEDe(B