AutoIt脚本的反编译和代码格式化问题分析(lua脚本反编译工具手机版)新鲜出炉

随心笔谈5个月前更新 admin
199 00
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买

文章摘要

这篇文章介绍了名为`au3formatter`的Python脚本,其主要目的是对AU3格式的文本文件进行处理和调整。脚本通过定义`au3formatter`函数和`main`函数,实现对输入文件中不同语句的缩进调整。具体来说,脚本根据输入行的开始关键词(如`;end;`、`;until;`、`;next;`、`;wend;`、`;if;`、`;for;`、`;select;`、`;switch;`、`;while;`、`;do;`、`;else;`、`;case;`等)自动调整缩进级别,从而生成符合特定格式的输出文件。该脚本能够处理多种AU3文件格式,并将其转换为指定的输出格式。


#!/usr/bin/env python2.7
#-*- coding: utf-8 -*-

_AU3=’;https://www.jb51.net/article/sample.au3′;
_AU3_OUT=’;https://www.jb51.net/article/format.au3′;
_INDENT=’; ‘; * 4

def au3formater(line, indent):
line=line.strip().lower()

next_indent=indent
if (line.startswith(‘;end’;) or
line.startswith(‘;until’;) or
line in (‘;next’;, ‘;wend’;)):
indent -=1
next_indent -=1
elif line.startswith(‘;if’;) and line.endswith(‘;then’;):
next_indent +=1
elif (line.startswith(‘;func’;) or
line.startswith(‘;for’;) or
line.startswith(‘;select’;) or
line.startswith(‘;switch’;) or
line.startswith(‘;while’;) or
line==’;do’;):
next_indent +=1
elif line.startswith(‘;else’;) or line.startswith(‘;case’;):
indent -=1
new_line=_INDENT * indent + line

return new_line, next_indent

def main():
with open(_AU3, ‘;r’;) as fp:
with open(_AU3_OUT, ‘;w’;) as fpw:
indent=0
line=fp.readline()
while line:
new_line, indent=au3formater(line, indent)
fpw.write(‘;%s\n’; % new_line)
line=fp.readline()

if __name__==’;__main__’;:
main()

© 版权声明

相关文章