【问题标题】:Remove Icons of exe Files automatically using jenkins使用 jenkins 自动删除 exe 文件的图标
【发布时间】:2023-02-02 12:25:10
【问题描述】:

我必须为一些与项目相关的工作更改 exe 文件的图标。我知道有一个名为 resource hacker 的工具用于删除图标,但我需要自动执行此过程(因为有更多的 exe 文件)。我已经使用 python 自动化了这个过程,但它是一个 GUI 自动化,它在 Jenkins 中不起作用。我需要使用应该与 jenkins 一起使用的脚本自动化。是否有任何 python 库可以从 exe 文件中删除图标或我们如何在 jenkins 中自动化。

这是在本地工作但在 jenkins 中不工作的 python 代码。 代码中提到的 exe files.txt 包含要更改的 exe 文件列表。

import time , os , pyautogui
os.startfile(u'"C:\Program Files (x86)\Resource Hacker\ResourceHacker.exe"')
time.sleep(1)
directory=r"D:\Downloads"
with open('exe files.txt') as x:   
    exe = [line.strip() for line in x]
for i in range(len(exe)):
    pyautogui.hotkey('ctrl', 'o')
    time.sleep(1)
    pyautogui.write(directory +'\\'+ exe[i])
    pyautogui.press('enter')
    time.sleep(1)
    pyautogui.press('delete')
    pyautogui.press('enter')
    pyautogui.hotkey('ctrl','s')
b=[]
for i in range(len(exe)):
    a=exe[i].split('.')
    b.append(a[0] + "_original." + a[1])
for i in range(len(b)):
    os.remove(directory +'\\'+b[i])

【问题讨论】:

    标签: python jenkins automation icons exe


    【解决方案1】:

    现在我找到了答案,

    使用资源黑客作为无头版本

    rh.exe -open source.exe -save save.exe -action delete -mask ICONGROUP
    

    【讨论】:

      猜你喜欢
      • 2016-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多