If $cmdline[0] <> 2 Then Exit MsgBox(48, "Warning!", "useage: upload.exe ""title of upload window"" ""file path to be upload""!")EndIf
$title=$CmdLine[1];
$fileupload=$CmdLine[2]

handleUpload($title,$fileupload)

Func handleUpload($title,$uploadfile)
if WinWait($title,"",5) Then
WinActivate($title);
ControlSetText($title, "", "Edit1", $fileupload );
Sleep(2000);
ControlClick($title, "", "Button1");
Else
MsgBox(48, "Warning!", "Upload window not found!")
Return False
EndIf
EndFunc

打包成exe 

# -*- coding: utf-8 -*-
import os
cmdlist=[]
toolpath=r'C:\upload.exe'
windowtitle=r'"Open"'
fileupload=r'"C:\yourfile.txt"'
cmdlist.append(toolpath)
cmdlist.append(windowtitle)
cmdlist.append(fileupload)
cmd=' '.join(cmdlist)
print cmd
os.system(cmd)