#Mark2 VBScript Command Version 1.00 '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' ExportHandy Ver 1.1 (2003/06/13) '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' [ŠT—v] ' ƒOƒ‹[ƒv”FŽ¯‚µ‚½—v‘f‚ð HandyCAD for Windows ‚Ö“]‘—‚µ‚Ü‚·B ' “]‘—}–Ê‚Í HandyCAD for Windows ‚Ì’¼‰º‚É ExportHandy\Œ»Ý‚ÌŽž.hnd ‚Æ‚µ‚Ä ' 쬂³‚ê‚Ü‚·B ' ' [’ˆÓ] ' ‚±‚̃vƒƒOƒ‰ƒ€‚ðŽg—p‚µ‚Ķ‚¶‚½‚¢‚©‚È‚éáŠQ‚à•ÛØ‚Í’v‚µ‚Ü‚¹‚ñB ' Ž©ŒÈÓ”C‚É‚¨‚¢‚ÄŒäŽg—p‰º‚³‚¢B ' ' [’˜ìŒ ] ' ‚±‚̃vƒƒOƒ‰ƒ€‚É•t‚¢‚Ă͈ꉞu‚łׂë‚Á‚Ïv‚ª ’˜ìŒ ‚ð—L‚µ‚Ä‚¢‚é‚ÆA‚±‚±‚É錾‚µ‚Ü‚·B ' “]—pA‰ü‘¢A‚»‚Ì‘¼‚à‚ë‚à‚ëAu‚łׂë‚Á‚Ïv‚Ì‹–‰Â‚È‚­Ž©—R‚És‚Á‚Ä‚­‚¾‚³‚¢B ' ’A‚µAƒIƒŠƒWƒiƒ‹‚Ìó‘Ԃł̉c—˜–Ú“I‚Æ‚µ‚½”Ì”„sˆ×‚Í‹–‰Â‚µ‚Ü‚¹‚ñ‚Ì‚ÅB ' '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ '¡ ƒiƒrƒQ[ƒVƒ‡ƒ“ƒ^[ƒQƒbƒg '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ const SI_NAVI_POINT = &H0001 '¡ À•W const SI_NAVI_ELEM = &H0002 '¡ —v‘f const SI_NAVI_POINTELEM = &H0003 '¡ (SI_NAVI_POINT|SI_NAVI_ELEM) const SI_NAVI_CORNER = &H0004 '¡ ƒR[ƒi[ const SI_NAVI_PAPER = &H0009 '¡ ƒy[ƒp[À•WŒn“ü—Í(ƒŒƒCƒ„kŽÚ–³‚µ) const SI_NAVI_FREEPOINT = &H0011 '¡ FreeÀ•W“ü—Í const SI_NAVI_ALLLAY = &H0020 '¡ ˆÙkŽÚ(—v‘fE—v‘f‚ÌŒð“_E’[“_E’†S“_)‚à‘S‚Ä”FŽ¯ '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ '¡ ƒIƒyƒŒ[ƒVƒ‡ƒ“‘®« '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ const SI_OPE_OPERATIONBACK = &H0010 '¡ ƒIƒyƒŒ[ƒVƒ‡ƒ“ƒoƒbƒN‚Ì‹–‰Â const SI_OPE_OPERATIONFIXED = &H0020 '¡ ƒIƒyƒŒ[ƒVƒ‡ƒ“Šm’è‚Ì‹–‰Â const SI_OPE_OPERATIONRESTART = &H0040 '¡ ƒIƒyƒŒ[ƒVƒ‡ƒ“ăXƒ^[ƒg‚Ì‹–‰Â '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ '¡ —v‘fˆ—ŠÖ˜A’è‹` '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ const SI_PROC_PRLL = &H00010000 '¡ •½sˆ— '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ Dim g_SvGroup const SID_GROUP = 100 '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' ƒRƒ}ƒ“ƒh‚Ì“ü‚èŒû•ŠJŽnƒCƒxƒ“ƒg '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ Sub Cmd_OnRun() ' ƒOƒ‹[ƒsƒ“ƒO—pƒT[ƒo[ƒRƒ}ƒ“ƒh‚ÌÝ’è Set g_SvGroup = Cmd.CreateSvCommand( "AutSiSvGroup" ) g_SvGroup.ProcType = SI_PROC_PRLL ' ƒIƒyƒŒ[ƒVƒ‡ƒ“ŠJŽn Cmd.OutputInfoString vbCrlf & "<< ExportHandy >>" & vbCrlf, 1 Cmd.SetOperationIndex 0 End Sub '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' ƒRƒ}ƒ“ƒh‚ÌI—¹ƒCƒxƒ“ƒg '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ Sub Cmd_OnTerminate() g_SvGroup.siGroupDtb.Close Set g_SvGroup = nothing End Sub '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' ƒIƒyƒŒ[ƒVƒ‡ƒ“‚̃CƒjƒVƒƒƒ‰ƒCƒYƒCƒxƒ“ƒg '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ Sub Cmd_OnInitOperation( OpIndex ) Select Case OpIndex Case 0 g_SvGroup.siGroupDtb.Close Cmd.LaunchServer SID_GROUP, g_SvGroup Case 1 Set rNavi = Cmd.siNavi Set rElemMask = rNavi.siElemMask rElemMask.SetBitAllOn rNavi.SetTarget SI_NAVI_POINT, 0, 0 Cmd.Operation = SI_OPE_OPERATIONBACK Cmd.SetStatusString "}–ÊŒ´“_‚ðŽw’肵‚ĉº‚³‚¢" End Select End Sub Sub Cmd_OnCadEventChangedFigure() Cmd.SetOperationIndex -1 End Sub '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' ƒIƒyƒŒ[ƒVƒ‡ƒ“ƒoƒbƒNƒCƒxƒ“ƒg '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ Sub Cmd_OnCadEventOperationBack( nID ) ' If nID = SID_GROUP Then Exit Sub Cmd.SetOperationIndex 0 End Sub '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' ƒIƒyƒŒ[ƒVƒ‡ƒ“Šm’èƒCƒxƒ“ƒg '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ Sub Cmd_OnCadEventFixed( nID ) If nID <> SID_GROUP Then Exit Sub Set rGroupDtb = g_SvGroup.siGroupDtb nCount = rGroupDtb.GetCount() 'ƒOƒ‹[ƒsƒ“ƒO” If nCount <= 0 Then MsgBox "ƒOƒ‹[ƒsƒ“ƒO—v‘f‚ª‘¶Ý‚µ‚Ü‚¹‚ñ" Cmd.SetOperationIndex 0 Exit Sub End If Cmd.SetOperationIndex 1 End Sub '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ' À•W“ü—Í '¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ Sub Cmd_OnCadEventInputCoord( iView, dspPoint ) Set rGroupDtb = g_SvGroup.siGroupDtb ' ì‹Æ—p}–ʃIƒuƒWƒFƒNƒg‚ðì¬ Set rWorkFig = Cmd.CreateElement( "AutSiFig" ) Set rWorkDtbCtrl = rWorkFig.siDtbCtrl ' ƒOƒ‹[ƒsƒ“ƒO—v‘f‚ðì‹Æ—p}–Ê‚ÖƒRƒs[‚·‚é Set ptDir = Cmd.CreateElement( "AutSiDtPoint" ) ptDir.x = 0 ptDir.y = 0 Set rProcCtrl = Cmd.CreateElement( "AutSiProcCtrl" ) bRet = rProcCtrl.SetData( rGroupDtb, TRUE ) bRet = rProcCtrl.SetPrll( dspPoint, ptDir ) bRet = rProcCtrl.Copy( rWorkFig, -1, 1) ' —̈撷‚ðÅ“K‰» Set rcArea = rWorkDtbCtrl.RecordRect( -1, 0, False, -1 ) xMargin = 0.025 * (rcArea.Max.x - rcArea.Min.x) yMargin = 0.025 * (rcArea.Max.y - rcArea.Min.y) Set FigInfo = Cmd.siFig.siFigInt.GetAttr( "AutSiFigInfo" ) Set WorkFigInfo = rWorkFig.siFigInt.GetAttr( "AutSiFigInfo" ) WorkFigInfo.Area.Min.x = rcArea.Min.x - xMargin WorkFigInfo.Area.Min.y = rcArea.Min.y - yMargin WorkFigInfo.Area.Max.x = rcArea.Max.x + xMargin WorkFigInfo.Area.Max.y = rcArea.Max.y + yMargin WorkFigInfo.FigrName = FigInfo.FigrName WorkFigInfo.FigrNumber = FigInfo.FigrNumber WorkFigInfo.Designer = FigInfo.Designer rWorkFig.siFigInt.SetAttr( WorkFigInfo ) ' ˆø‚«“n‚µƒtƒ@ƒCƒ‹‚ðì‹ÆƒfƒBƒŒƒNƒgƒŠ‚É•Û‘¶‚·‚é Set rSupport = Application.siSupport Set rFigManager = Application.siFigManager strTempFile = rSupport.GetEnviron( "TemporarytDirectory" ) strTempFile = strTempFile & "ExportHandy.hnd" bSts = rFigManager.DoSave( ".HND", strTempFile , rWorkFig ) '}–Ê‘‚«o‚µ if bSts = false Then MsgBox "}–ʂ̶¬‚ÉŽ¸”s‚µ‚Ü‚µ‚½B" & vbCrlf & strTempFile Cmd.DoExit 'I—¹ Exit Sub End If ' HandyCAD for Windows ‚Ì‹N“® On Error Resume Next Set HandyWinApp = GetObject( , "HandyWin.Application" ) '‹N“®Ï‚ÝH If HandyWinApp is nothing Then Set HandyWinApp = CreateObject( "HandyWin.Application" ) 'V‹K‚É—§‚¿ã‚°‚é If HandyWinApp is nothing Then MsgBox "HandyCAD for Windows ‚Ì‹N“®‚ÉŽ¸”s‚µ‚Ü‚µ‚½B" Cmd.DoExit() Exit Sub End If End If ' }–ʃtƒHƒ‹ƒ_‚̶¬‚Æ}–ʃtƒ@ƒCƒ‹‚̃Rƒs[ Set fso = CreateObject( "Scripting.FileSystemObject" ) strModulePath = HandyWinApp.FullName strFolder = fso.GetParentFolderName( strModulePath ) strFolder = strFolder & "\ExportHandy" If not( fso.FolderExists( strFolder ) ) Then fso.CreateFolder( strFolder ) End If CurDate = Now strFname = Year(CurDate) strFname = strFname & Month(CurDate) strFname = strFname & Day(CurDate) strFname = strFname & Hour(CurDate) strFname = strFname & Minute(CurDate) strFname = strFname & Second(CurDate) strFname = strFname & ".hnd" strHandyFile = strFolder & "\" & strFname bRet = fso.CopyFile( strTempFile, strHandyFile, true ) fso.DeleteFile( strTempFile ) Cmd.OutputInfoString strHandyFile & vbCrlf, 0 ' }–Ê‚ðŠJ‚­ HandyWinApp.Visible = true ' HandyWinApp.Activate HandyWinApp.ActiveDocument.Open strHandyFile Cmd.SetOperationIndex 0 End Sub