import configparser
from win32com.client import Dispatch
from JSX2 import dxf3_jscode
from JSX3 import dxf2_jscode
from JSX1 import dxf_jscode
from JSX4 import dxf4_jscode
from JSX5 import dxf5_jscode
from JSX6 import dxf6_jscode
from JSX7 import dxf7_jscode
from JSX8 import dxf8_jscode
psapp = None
aiapp = None
#config = configparser.ConfigParser()
#config.read('程序配置.ini', encoding='utf-8')
#PS应用名 = config.get('程序配置', 'PS应用名')

# from datetime import datetime  # 引入datetime，获取当前日期
# import sys  # 引用退出程序方法
#
# ## 逻辑实现
# d1 = datetime.now().date()
# d2 = pd.to_datetime('2023-9-15').date()
#
# print("当前日期:", d1)
# print("限制日期:", d2)
#
# if d1 > d2:
#     print('软件已过期，请联系作者！')
#     sys.exit()
def 运行PS_DXF_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf_jscode + '\n' + funcode)
    return res




def 运行PS_DXF2_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf2_jscode + '\n' + funcode)
    return res


def 运行PS_DXF3_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf3_jscode + '\n' + funcode)
    return res

def 运行PS_DXF4_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf4_jscode + '\n' + funcode)
    return res


def 运行PS_DXF5_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf5_jscode + '\n' + funcode)
    return res

def 运行PS_DXF6_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf6_jscode + '\n' + funcode)
    return res


def 运行PS_DXF7_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf7_jscode + '\n' + funcode)
    return res

def 运行PS_DXF8_jscode_fun(funcode):
    print(funcode)
    global psapp
    if psapp is None:
        psapp = Dispatch(PS应用名)
    res = psapp.DoJavaScript(dxf8_jscode + '\n' + funcode)
    return res



def main():

        pass

if __name__ == '__main__':
    main()
