利用chrome伪装成自己的app

 书接上文《以app形式启动chrome 

1、编写程序

为了让客户感到我们就是一个app,利用Python写了一个创建桌面快捷方式的代码。

Python需安装winshell,pywin32,安装PyInstaller用来将我们的Python代码编译成可执行的exe

代码如下:

# -*- coding: UTF-8 -*-
__author__ = 'wiselyman'


import os ,winshell,sys
from win32com.client import Dispatch

reload(sys)
sys.setdefaultencoding('utf8')

desktop = winshell.desktop()
path = os.path.join(desktop,"腾讯.lnk")
target = r"C:\gfdy\gfdy.exe"
arguments = "--app=http://www.qq.com"
wDir = r"C:\gfdy"
icon = r"C:\Windows\System32\PerfCenterCpl.ico"


shell = Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(path)
shortcut.TargetPath = target
shortcut.Arguments = arguments
shortcut.WorkingDirectory = wDir
shortcut.IconLocation = icon
shortcut.save()

利用

pyinstaller shortcut.py

 将py编译成exe

2 绿色chrome

chrome安装之后本身就是绿色的,可以复制到其他机器运行,将shortcut编译成的exe所在的文件夹放在chrome目录下。

3 程序打包

右键点击chrome的目录,使用winrar打包自解压程序,在高级设置里,设置解压完执行shortcut.exe的地址。

猜你喜欢

转载自wiselyman.iteye.com/blog/2181217