掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
プロジェクト内で使用中のフォームのキャプションの一覧 (ID:41436)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
良く考えたら、前述の方法では、プロジェクトから削除したフォームも拾ってしまうため、プロジェクトファイルもチェックしないと確実とは言えません。 例えば、VBスクリプト(ここでは場違いかもしれませんが...)で、一覧を出力する方法は次のようになります。 テキスト整形部分は、用途に合わせて書き換えてください。 尚、ASCIIとUNICODEの境界を判別していないので、'#12345'のようなキャプションがあると文字化けしますので注意。 set Fs = CreateObject("Scripting.FileSystemObject") ' 作業パス FullName = WScript.ScriptFullName Folder = Left(FullName, instrrev(FullName, "\")) ' 結果保存用 set Caption = Fs.CreateTextFile(Folder & "Caption.txt") ' プロジェクトファイルの取得 for each F in Fs.GetFolder(Folder).Files if Fs.GetExtensionName(F) = "dproj" then set Dproj = Fs.OpenTextFile(F) All = Dproj.ReadAll Dproj.Close exit for end if next ' プロジェクトフォルダ内のパラメータファイルを取得 for each F in Fs.GetFolder(Folder).Files if Fs.GetExtensionName(F) = "dfm" then Set Text = Fs.OpenTextFile(F) do Line = Text.ReadLine ' フォーム名の取得 if Instr(Line, "object ") = 1 then head = Instr(Line, " ")+1 tail = Instr(Line, ":") tmp1 = Mid(Line, head, tail-head) end if ' 当該フォームがプロジェクトに含まれるかチェック if Instr(All, "<Form>" & tmp1 & "</Form>") = 0 then exit do ' キャプションの取得 if Instr(Line, "Caption = ") = 3 then set Re = New RegExp Re.Pattern = "#\d+\d+\d+\d+\d*\d*\d*" Re.Global = True set Unicodes = Re.Execute(Line) tmp2 = LTrim(Line) for each Unicode in Unicodes Decimal = Replace(Unicode.Value, "#", "") tmp2 = Replace(tmp2, Unicode.Value, ChrW(Decimal)) next ' テキスト整形 tmp1 = tmp1 & Space(10-Len(tmp1)) tmp2 = Replace(tmp2, "'", "") Caption.WriteLine(tmp1 & " : " & tmp2) exit do end if loop until Text.AtEndOfStream Text.Close end if next Caption.Close プロジェクトフォルダ内で実行してみてください。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.