Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
afxscript - あふwで指定した単位でファイルを選択する(奇数番目を選択等)
'&SCRIPT afxselect.vbs x y
' x: 単位
' y: 選択位置
'
' 例) 奇数を選択
' &SCRIPT afxselect.vbs 2 1
' wscript.exe afxselect.vbs 2 1
'
Set ao = CreateObject("afxw.obj")
Set fso = CreateObject("Scripting.FileSystemObject")
Set src = fso.GetFolder(ao.Extract("$P"))
Dim idx
Dim cnt
Dim num
idx = 0
cnt = 2
num = 0
If WScript.Arguments.Count > 1 Then
cnt = CInt(WScript.Arguments.Item(0))
num = CInt(WScript.Arguments.Item(1))
End If
ao.MesPrint cnt & "-" & num
For Each FileName In src.Files
If Idx Mod cnt = num Then
ao.Exec("&MARK -F " & FileName.Name)
ao.MesPrint "&MARK -F " & FileName.Name
End If
Idx = Idx + 1
Next
Set ao = Nothing
Set fso = Nothing
Set src = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment