2009年7月26日 星期日

這隻猴子還不錯!

猿丸鍵店∼日劇板(2009夏)

這一部要追…

--
---- 書本上查的到的東西 ---- 不用去背他 ----

2009年7月19日 星期日

飲鴆

天氣熱∼喝杯冰涼的毒藥吧!

--
---- 書本上查的到的東西 ---- 不用去背他 ----

2009年7月17日 星期五

Fwd: 利用Lotus Symphony轉PDF



打開檔案、按下「匯出」即完成!



--
---- 書本上查的到的東西 ---- 不用去背他 ----

2009年7月9日 星期四

[Lotus Script]-Fwd: Notes、Richtext欄位中- 附件檔案位置控制

End Function將文件中的附件檔案抓到硬碟裡,經過壓縮後要再放回去。
嵌入檔案的位置都會跑掉。
為此花了兩天的時間再尋求解決之道∼終於找到搭配NotesRichTextNavigator來定位附件檔案的位置了!

附加檔放回原位:使用 NotesRichTextNavigator

Set rtnav = item.CreateNavigator
If Not rtnav.FindLastElement(RTELEM_TYPE_FILEATTACHMENT) Then
Msgbox "此份文件中沒有附件"
Exit Sub
Else
Call rtnav.FindFirstElement(RTELEM_TYPE_FILEATTACHMENT)
Do
'CtrNav = CtrNav +1
Loop While rtnav.FindnextElement(RTELEM_TYPE_FILEATTACHMENT)
'Msgbox CtrNav
End If
略…

Call rtnav.FindNthElement(RTELEM_TYPE_FILEATTACHMENT,"計數器")
Call item.BeginInsert(rtnav,False)
進行附加檔嵌入作業…
Call item.EndInsert
Call doc.Save(True,False)

略…

…萬事OK!


--
---- 書本上查的到的東西 ---- 不用去背他 ----

[Lotus Script]-在Notes裡面抓取「Windows系統路徑」

<<宣告WinAPI>>

Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (Byval lpBuffer As String, _
Byval nSize As Long) As Long

<<使用: >>

DirTmp =Environ$("temp") & "\"

∼得到值:d:\tmp\ ←我自己設到D去的

參數對照:
number envstring
1 ALLUSERSPROFILE
2 APPDATA
3 CLIENTNAME
4 CommonProgramFiles
5 COMPUTERNAME
6 ComSpec
7 FP_NO_HOST_CHECK
8 HOMEDRIVE
9 HOMEPATH
10 LOGONSERVER
11 NUMBER_OF_PROCESSORS
12 OS
13 Path
14 PATHEXT
15 PROCESSOR_ARCHITECTURE
16 PROCESSOR_IDENTIFIER
17 PROCESSOR_LEVEL
18 PROCESSOR_REVISION
19 ProgramFiles
20 SESSIONNAME
21 SystemDrive
22 SystemRoot
23 TEMP
24 TMP
25 USERDOMAIN
26 USERNAME
27 USERPROFILE
28 windir

--
---- 書本上查的到的東西 ---- 不用去背他 ----

2009年7月7日 星期二

[Lotus Script]-附件、壓縮

找到了一個可以壓ZIP的DLL檔,可以不用看WinRAR跟7zip的臉色了。

說明:
1.附檔解壓縮後,將該DLL檔放到C:\Windows\ 目錄底下。
2.代理程式使用方式:
※在「Delarations」裡輸入下列程式碼來引用VCZIPSUP.DLL:

Declare Function Zip Lib "VCZIPSUP.DLL" (_
Byval pstrInputDirectory As String, _

Byval pstrFileWildCardSpec As String, _

Byval pstrOutputZipFilename As String, _

Byval iIncludeSubDirs As Integer, _

Byval iKeepFolderStructure As Integer, _

Byval pstrOptions As String) As Long


※在代理程式程式裡呼叫:
Sub Initialize
Dim lRc As Long

lRc = Zip("D:\Temp\Files","*.*", "D:\Temp\MyFirstZipFile.zip",1, 0,"")

End Sub


一、來源路徑
二、來源檔名 (輸入 *.* 可以將該目錄下所有檔案打包壓縮)
三、輸出路徑及檔名
四、未知
五、未知
六、未知

壓縮完成、lRc會返回"0"

==================================================================

另附上修改後的程式。

Sub Initialize
Dim ss As New notessession
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim Arcobj As NotesEmbeddedObject
Dim doc As NotesDocument
Dim Newitem As Variant, item As Variant
Dim RarPath As String, RarDirName As String, RarFileName As String
Dim result As Integer, RarFinal As String,oName As String,lRc As Long

Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document

RarPath = "D:\Tmp\ZIP\"

If doc.HasEmbedded Then
RarDirName = Format$(Now(), "hhnnss")
Mkdir RarPath & RarDirName
RarFinal = RarPath & RarDirName

If Not uidoc.EditMode Then uidoc.EditMode = True
Call uidoc.Save

Set item = doc.GetFirstItem("Body")
Forall embobj In item.EmbeddedObjects
oName= embobj.name
Call embobj.ExtractFile( RarFinal & "\\" & oName)
Call embobj.remove
End Forall
Call doc.save(True, False)

%REM
result = Shell("C:\Program Files\7-Zip\7z.exe a " & RarFinal & ".zip" & " " & RarFinal , 1)
Dim ii As Long
For ii = 1 To 10000000
Next
%END REM
lRc = Zip(RarFinal,oName,RarFinal & ".zip",1, 0,"")

Set Newitem = doc.GetFirstItem("Body")
Set Arcobj = Newitem.EmbedObject(EMBED_ATTACHMENT, "", RarFinal & ".zip")
'Set Arcobj = Newitem.EmbedObject(EMBED_ATTACHMENT, "", "D:\Tmp\ZIP\À£.zip")
Call doc.Save( True, True )
Call uidoc.Save

Dim newdoc As New notesdocument( ss.CurrentDatabase )
Set newdoc = doc
Call uidoc.Close
Call workspace.EditDocument(True, newdoc)

Kill RarFinal & ".zip"
'Rmdir RarFinal
Else
Print Now()+" No Embedded Object"
End If
End Sub




--
---- 書本上查的到的東西 ---- 不用去背他 ----

2009年7月6日 星期一

末日

最近的夕陽都不錯呢!

--
---- 書本上查的到的東西 ---- 不用去背他 ----

2009年7月2日 星期四

[Lotus Script]_Word轉轉轉!

開啟Word檔、並插入自訂浮水印。
                                                                

Sub Initialize
'(WORD開開開)|agWordOpen
Dim session As New NotesSession
Dim db As NotesDatabase
Dim wdoc As NotesDocument
Dim pdoc As NotesDocument
Dim PrintHeadFlag As Integer
Dim DefWMStr As String,DefDocPath As String
Set db=session.CurrentDatabase
Set wdoc=session.DocumentContext

DefWMStr = "日期:" & Cstr(Today) & " // 作者:Signally" '設定水印文字
DefDocPath="D:\t1.dot" '設定路徑

Set oWord = CreateObject("Word.Application")
oWord.Application.Visible = True
oWord.documents.Add DefDocPath, False

'=======Insert Watermark======
oWord.ActiveDocument.Sections(1).Range.Select
oWord.ActiveWindow.ActivePane.View.SeekView = 9 'wdSeekCurrentPageHeader
oWord.Selection.HeaderFooter.Shapes.AddTextEffect(PowerPlusWaterMarkObject1,DefWMStr, "標楷體", 1, False, False, 0, 0).select
oWord.Selection.ShapeRange.Name = "PowerPlusWaterMarkObject1"
oWord.Selection.ShapeRange.TextEffect.NormalizedHeight = False
oWord.Selection.ShapeRange.Line.Visible = False
oWord.Selection.ShapeRange.Fill.Visible = True
oWord.Selection.ShapeRange.Fill.Solid
oWord.Selection.ShapeRange.Fill.ForeColor.RGB = 30 '色彩?
oWord.Selection.ShapeRange.Fill.Transparency = 0.6 '透明度
oWord.Selection.ShapeRange.Rotation = 315 '角度(依照頂端指向)
oWord.Selection.ShapeRange.LockAspectRatio = True
oWord.Selection.ShapeRange.Height =240 'CentimetersToPoints(4.13) '高
oWord.Selection.ShapeRange.Width = 270 'CentimetersToPoints(16.52) '寬
oWord.Selection.ShapeRange.WrapFormat.AllowOverlap = True
oWord.Selection.ShapeRange.WrapFormat.Side = wdWrapNone
oWord.Selection.ShapeRange.WrapFormat.Type = 3
oWord.Selection.ShapeRange.RelativeHorizontalPosition = 0 'wdRelativeVerticalPositionMargin '基準點
oWord.Selection.ShapeRange.RelativeVerticalPosition = 0 'wdRelativeVerticalPositionMargin '基準點
oWord.Selection.ShapeRange.Left = wdShapeCenter
oWord.Selection.ShapeRange.Top = wdShapeCenter
oWord.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
'==========================
oWord.documents(1).SaveAs "d:\TryWM20090702.doc"
End Sub


--
---- 書本上查的到的東西 ---- 不用去背他 ----