日々適当

hibitekitou

MacでWindows向けのZipファイルを作成する

mac |2010-01-05
これは別にMacが悪いわけじゃないのだろうけど、Macの標準の圧縮ツールで圧縮されたzipファイルに日本語名のファイルやフォルダが含まれると、そいつらの名前がWindowsで伸張した時文字化けするわけです。

そこで今月のMacPeopleに素敵な記事が載っていました。
Automatorで以下のようなサービスメニューを作ってやるわけです。



MacZip4Winというツールで圧縮してやろうというわけですね。

MacZip4Win [Ranaとの日々]

Mac OS X 10.6 からはサービスメニューがコンテクストメニューから呼び出されるようになったので、ファイルフォルダを選んで右クリックで作成したアクションを実行できます。たとえば以下はファイルフォルダ名すべてが日本語です。



こうして作成されたzipファイルは、Windows XP上では以下のように見えました。



この方法の欠点としては、作成されたzipファイルをMac OS XのQuickLookで開くと( BetterZipQL を入れてあります)文字化けして見えることですけど、もちろん、Finder上でのダブルクリックで正常に伸張されます。

ってことで、元ネタが雑誌記事であれですけど、ちょっと感銘を受けたので書いてみました。
コメント ( 0 )|Trackback ( )

コントロール属性の設定

xsi |2010-01-05
メモ:Softimage、SDKマニュアルの「コントロール属性の設定」の部分のスクリプトをPythonにしてみたもの。

from win32com.client import constants as c


# This function toggles between displaying the number slider and 
# check box on two lines vs. the same line
LC = '''
from win32com.client import constants as c
def ChangeLayoutDemo_OnClicked():
	oCtrl = PPG.PPGLayout.Item( "NumberDemo" )
	if ( oCtrl.GetAttribute(c.siUIContinue) ) :
		oCtrl.SetAttribute( c.siUIContinue, False )
	else:
		oCtrl.SetAttribute( c.siUIContinue, True )
	PPG.Refresh()
'''

app = Application
oRoot = app.ActiveSceneRoot

# Set up the underlying parameters
oPSet = oRoot.AddProperty( "CustomProperty", False, "Demo" )

oPSet.AddParameter3( "FileDemo", c.siString )
oPSet.AddParameter3( "NumberDemo", c.siDouble )
oPSet.AddParameter3( "Mute", c.siBool )

# Set up the PPGItems on the layout
oPPGLayout = oPSet.PPGLayout
oParamStr = oPPGLayout.AddItem( "FileDemo", "FileDemo", c.siControlFilePath )
oParamDbl = oPPGLayout.AddItem( "NumberDemo", "NumberDemo", c.siControlNumber )
oParamBoo = oPPGLayout.AddItem( "Mute", "Mute", c.siControlBoolean )


# For the file widget, set the file filter to *.pic and *.bmp
oParamStr.SetAttribute( c.siUIFileFilter, "Softimage PIC files (*.pic)|*.pic|Bitmap files (*.bmp)|*.bmp|All Files (*.*)|*.*||" )

# For the number control, specify # of decimals and use treadmill widget
oParamDbl.SetAttribute( c.siUIDecimals, 3 )
oParamDbl.SetAttribute( c.siUITreadmill, True )

# For the check box, decrease the width
oParamBoo.SetAttribute( c.siUIWidthPercentage, "50" )
# (equivalent to oParamBoo.WidthPercentage = 50)


# Add a click event to the button which will demonstrate 
# how to set these attributes via property page logic
oPPGLayout.AddButton( "ChangeLayoutDemo", "Change Layout" )
oPPGLayout.Language = "Python"
oPPGLayout.Logic = LC

Application.InspectObj( oPSet, '', '',  c.siRecycle,)

コメント ( 0 )|Trackback ( )
  ・