3

I'm trying to open Adv5KTCP.exe (path shown in code) but this exe actually opens three more avi.files as shown in image below. This causes the error. I've tried os, subprocess & pywinauto to call but to no avail. I've also tried adding the files path to environmental variable but I think that makes no sense. Opening the exe from command prompt does not work too. However, the exe can be opened manually by double clicking the exe file (like the usual). I just need it to be automated.

AVI Files: avi files

The Error:

enter image description here

Double clicking the exe would open this window:

enter image description here

Here is my code:

import os
import sys, logging
import subprocess
import ctypes
from pywinauto import Application

def is_admin():
    try:
        return ctypes.windll.shell32.IsUserAnAdmin()
    except:
        return False

if is_admin():
    exe  = "Adv5KTCP.exe"  #path set in environment variable: "C:\Program Files (x86)\Advantech\ADAM-5000TCP-6000 Utility\Program"
    os.startfile(exe)
    # subprocess.Popen([exe])
    # application = Application(backend="uia").start(exe)
else:
    ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)

Does anybody have any idea on how I could go about this? Thank you in advance for your response.

New Findings:

I tried to cut the three AVI files to desktop & set desktop path to system variable & the exe gives the same error. However when i cut the exe file to desktop with the avi files as shown below, it works! Even when the other required files are not in desktop but path's set to system variable. Which means the exe is somehow registering the paths of the avi upon click, location/position or some sort which I'm not sure of.

enter image description here

Sin Han Jinn
  • 574
  • 3
  • 18
  • I've also placed the path of the folder that contains the AVI files & exe in the system variable. But nothing works. For now.. – Sin Han Jinn Oct 01 '19 at 23:32
  • Guys, its been 6 days now, I'm shifting over to their new application that has no problems. I'll leave this hanging so that someone could teach us something new. Thanks for all your help. – Sin Han Jinn Oct 07 '19 at 23:45

0 Answers0