; 修改 IP 地址和子网
#SingleInstance, Force

Str := "255.255.255.25" ; 删除此行以使用实际剪贴板数据

; 将MsgBox替换为Send以匹配原始示例
MsgBox, % DGCalc(Str)
MsgBox, % SubnetCalc(Str)
MsgBox, % UseCalc(Str)

; https://www.autohotkey.com/boards/viewtopic.php?p=281363#p281363
DGCalc(Address) {
  RegExMatch(Address, "(\d+).(\d+).(\d+).(\d+)", M)
  return M1 "." M2 "." M3 "." M4 + 1
}

SubnetCalc(Address) {
  arrSubnet := {24:0, 25:128, 26:192, 27:224, 28:240, 29:248, 30:252, 31:254, 32:255}
  RegExMatch(Address, "(\d+).(\d+).(\d+).(\d+)", M)
  return M1 "." M2 "." M3 "." arrSubnet[M4]
}

UseCalc(Address) {
  arrSubnet := {24:252, 25:124, 26:60, 27:28, 28:12, 29:4}
  RegExMatch(Address, "(\d+).(\d+).(\d+).(\d+)", M)
  return M1 "." M2 "." M3 "." (M4 + 2) " - " M1 "." M2 "." M3 "." (M4 + 2) + arrSubnet[M4]
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。