sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #54178
Re: [Question #688872]: Get build number of .exe file
Question #688872 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/688872
Asheru posted a new comment:
I found a solution for this. Not the best but simple and quick (works
for me).
So I have a script named "GetSetupBuildNumber.py", that uses win32
package wich normally would not work executed from a sikuli script for
printing the build number. Here is the code:
--from win32api import GetFileVersionInfo, LOWORD, HIWORD
def get_version_number (filename):
info = GetFileVersionInfo (filename, "\\")
ms = info['FileVersionMS']
ls = info['FileVersionLS']
return HIWORD (ms), LOWORD (ms), HIWORD (ls), LOWORD (ls)
if __name__ == '__main__':
import os
filename = os.environ["COMSPEC"]
print (".".join ([str (i) for i in get_version_number (path_to_file)]))--
Then inside the sikuli script I have a function that looks like this:
--def get_build_number_from_exe_file():
theproc = subprocess.Popen(path_to_file, shell = True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
tmp = theproc.stdout.read()
theproc.communicate()
print tmp --
So what It does, it executes a python script that prints the build number in the console. Then it is read from the console and stored in 'tmp' variable.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.