【基本関数】 : baseFunction


  GetWshShell

Microsoft のリファレンスへのリンク

  

REM **********************************************************
REM WScript.Shell の取得
REM **********************************************************
Function GetWshShell( )

	if not IsObject( WshShell ) then
		Call GetObj( "WshShell", "WScript.Shell" )
	end if

End Function
  

  RunAsync

  

REM **********************************************************
REM 非同期実行
REM **********************************************************
Function RunAsync( strCommand )

	GetWshShell
	Call WshShell.Run( strCommand )

End Function
  

  RunSync、RunSync2

実行プログラムのパスが、空白を含んでいる場合は Dd を使用して下さい

  

REM **********************************************************
REM 同期実行( 必要ならコマンドプロンプトを開く )
REM **********************************************************
Function RunSync( strCommand )

	GetWshShell
	Call WshShell.Run( strCommand, , True )

End Function

REM **********************************************************
REM 同期実行( コマンドプロンプトを開かない )
REM **********************************************************
Function RunSync2( strCommand )

	GetWshShell
	Call WshShell.Run( strCommand, 0, True )

End Function
  

  RunBat、RunBatParam

GetInline で取得したテキストをバッチファイルとして実行します

  

REM **********************************************************
REM バッチファイル 実行
REM **********************************************************
Function RunBat( strName )

	Dim strPath,strCommand

	strPath = Tempdir & "\" & strName & ".bat"
	Call PutTextFile( strPath, GetInline(strName) )
	strCommand = "cmd.exe /c " & Dd( strPath )
	RunSync( strCommand )

End Function

REM **********************************************************
REM バッチファイル パラメータ(置き換え)実行
REM **********************************************************
Function RunBatParam( strName, bPause, strParamList )

	Dim strPath,strCommand,aParam,str,I

	aParam = Split(strParamList,",")

	strPath = Tempdir & "\" & strName & ".bat"
	str = GetInline(strName)
	For I = 0 to Ubound( aParam ) step 2
		str = Replace( str, aParam(I), aParam(I+1) )
	Next
	Call PutTextFile( strPath, str )
	strCommand = "cmd.exe /c " & Dd( strPath )
	RunSync( strCommand )

End Function
  

  RunPhp、RunPhpParam

  

REM **********************************************************
REM PHP 実行
REM **********************************************************
Function RunPhp( strName, bPause )

	Dim strPath,strCommand

	strPath = Tempdir & "\" & strName & ".php"
	Call PutTextFile( strPath, GetInline(strName) )
	if bPause then
		strCommand = "cmd.exe /c php.exe " & Dd( strPath ) & " & pause"
	else
		strCommand = "php.exe " & Dd( strPath )
	end if
	RunSync( strCommand )

End Function

REM **********************************************************
REM PHP パラメータ(置き換え)実行
REM **********************************************************
Function RunPhpParam( strName, bPause, strParamList )

	Dim strPath,strCommand,aParam,str,I

	aParam = Split(strParamList,",")

	strPath = Tempdir & "\" & strName & ".php"
	str = GetInline(strName)
	For I = 0 to Ubound( aParam ) step 2
		str = Replace( str, aParam(I), aParam(I+1) )
	Next
	Call PutTextFile( strPath, str )
	if bPause then
		strCommand = "cmd.exe /c php.exe " & Dd( strPath ) & " & pause"
	else
		strCommand = "php.exe " & Dd( strPath )
	end if
	RunSync( strCommand )

End Function
  

  CopyNewfile、CopyAllfile

  

REM **********************************************************
REM XCOPY で新しいファイルのみコピー
REM **********************************************************
Function CopyNewfile(SourceDir,DestinationDir)

	Dim nRet

	GetWshShell

	ExecCommand = "xcopy.exe """ & SourceDir & """ """ & DestinationDir & """ /D /E /C /S /Y"

	RunSync( ExecCommand )

End function

REM **********************************************************
REM XCOPY で全てのファイルコピー
REM **********************************************************
Function CopyAllfile(SourceDir,DestinationDir)

	Dim nRet

	GetWshShell

	ExecCommand = "xcopy.exe """ & SourceDir & """ """ & DestinationDir & """ /E /C /S /Y"

	RunSync( ExecCommand )

End function
  

  GetWshNetwork、GetDic、GetShell

  

REM **********************************************************
REM WScript.Network の取得
REM **********************************************************
Function GetWshNetwork( )

	if not IsObject( WshNetwork ) then
		Call GetObj( "WshNetwork", "WScript.Network" )
	end if

End Function

REM **********************************************************
REM ディクショナリオブジェクトの取得
REM **********************************************************
Function GetDic( )

	if not IsObject( Dic ) then
		Call GetObj( "Dic", "Scripting.Dictionary" )
	end if

End Function

REM **********************************************************
REM Shell オブジェクトの取得
REM **********************************************************
Function GetShell( )

	if not IsObject( Shell ) then
		Call GetObj( "Shell", "Shell.Application" )
	end if

End Function
  

  SelectDir

  

REM **********************************************************
REM フォルダ選択
REM **********************************************************
Function SelectDir( strTitle )

	if ScriptType <> 3 then
	else
		Exit Function
	end if

	GetShell

	Dim obj

	Set obj = Shell.BrowseForFolder( 0, strTitle, 11, 0 )
	if obj is nothing then
		SelectDir = ""
		Exit Function
	end if
	if not obj.Self.IsFileSystem then
		ErrorMessage = "ファイルシステムではありません"
		SelectDir = ""
		Exit Function
	end if

	SelectDir = obj.Self.Path

End Function

Function SelectDirAndFile( strTitle )

	if ScriptType <> 3 then
	else
		Exit Function
	end if

	GetShell

	Dim obj

	on error resume next
	Set obj = Shell.BrowseForFolder( 0, strTitle, 11 + &h4000, 0 )
	if Err.Number <> 0 then
		ErrorMessage = "ファイルが選択されました"
		SelectDirAndFile = ""
		Exit Function
	end if
	on error goto 0
	if obj is nothing then
		SelectDirAndFile = ""
		Exit Function
	end if
	if not obj.Self.IsFileSystem then
		ErrorMessage = "ファイルシステムではありません"
		SelectDirAndFile = ""
		Exit Function
	end if

	SelectDirAndFile = obj.Self.Path

End Function
  

  OpenDir

  

REM **********************************************************
REM エクスプローラで開く
REM **********************************************************
Function OpenDir( strPath )

	strCommand = "explorer.exe  /e," & Dd(strPath)
	RunSync(strCommand)

End Function
  




yahoo  google  MSDN  MSDN(us)  WinFAQ  Win Howto  tohoho  ie_DHTML  vector  wdic  辞書  天気 


[webwsh]
CCBot/2.0 (https://commoncrawl.org/faq/)
19/12/12 15:38:33
InfoBoard Version 1.00 : Language=Perl

BatchHelper COMprog CommonSpec Cprog CprogBase CprogSAMPLE CprogSTD CprogSTD2 CprogWinsock Cygwin GameScript HTML HTMLcss InstallShield InstallShieldFunc JScript JScriptSAMPLE Jsfuncs LLINK OldProg OracleGold OracleSilver PRO PRObrowser PROc PROconePOINT PROcontrol PROftpclient PROjscript PROmailer PROperl PROperlCHAT PROphp PROphpLesson PROphpLesson2 PROphpLesson3 PROphpfunction PROphpfunctionArray PROphpfunctionMisc PROphpfunctionString PROsql PROvb PROvbFunction PROvbString PROvbdbmtn PROvbonepoint PROwebapp PROwin1POINT PROwinSYSTEM PROwinYOROZU PROwindows ProjectBoard RealPHP ScriptAPP ScriptMaster VBRealtime Vsfuncs a1root access accreq adsi ajax amazon argus asp aspSample aspVarious aspdotnet aw2kinst cappvariety centura ckeyword classStyle cmaterial cmbin cmdbapp cmenum cmlang cmlistbox cmstd cmstdseed cmtxt cs daz3d db dbCommon dbaccess dnettool dos download flex2 flex3 flex4 framemtn framereq freeWorld freesoft gimp ginpro giodownload google hdml home hta htmlDom ie9svg install java javaSwing javascript jetsql jquery jsp jspTest jspVarious lightbox listasp listmsapi listmsie listmsiis listmsnt listmspatch listmsscript listmsvb listmsvc memo ms msde mysql netbeans oraPlsql oracle oracleWiper oraclehelper orafunc other panoramio pear perl personal pgdojo pgdojo_cal pgdojo_holiday pgdojo_idx pgdojo_ref pgdojo_req php phpVarious phpguide plsql postgres ps r205 realC realwebapp regex rgaki ruby rule sboard sc scprint scquest sdb sdbquest seesaa setup sh_Imagick sh_canvas sh_dotnet sh_google sh_tool sh_web shadowbox shgm shjquery shvbs shweb sjscript skadai skywalker smalltech sperl sqlq src systemdoc tcpip tegaki three toolbox twitter typeface usb useXML vb vbdb vbsfunc vbsguide vbsrc vpc wcsignup webanymind webappgen webclass webparts webtool webwsh win8 winofsql wmi work wp youtube