aa2zz6 Posted August 29, 2019 Posted August 29, 2019 When I run my script the GUI getting embedded with our ticketing software gets buggy and random white blocks will appear above and below text and buttons if that makes sense. Am I possibly missing something in my script or is it a type of WinAPI issue? expandcollapse popup#include <File.au3> #include <WinAPI.au3> #include <GUIConstants.au3> Opt("WinTitleMatchMode",2) Local $msg, $hwnd, $Nhandle Global Enum $RFS_ERROR_RUN = 2 Global Const $g_sFileName = 'webtms.exe', _ $g_sFilePath = 'C:\EIS\', _ $g_sFileMsg = 'file : "%s"\n(sub-)folder : "%s"\nlocated at : "%s"\n' ; Launch Ticketing Software If Not ProcessExists("webtms.exe") then $pid = _RunFromSubfolder($g_sFileName, $g_sFilePath) ProcessWait($pid) EndIf ; Wait unti user signs in Local $webtmsResolution = WinWait("[TITLE:[ohtmsa.oups.org]]") $pos = WinGetPos($webtmsResolution) ; Create GUI with webTMS Width & Height $hwnd = GUICreate("WebTMS Ticket Project",$pos[2],$pos[3],0,0, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) GUISetState() ; Embedding webTMS with AutoIT GUI $Nhandle = WinGetHandle("[TITLE:[ohtmsa.oups.org]]") _WinAPI_SetParent($Nhandle, $hwnd) _WinAPI_SetWindowLong($Nhandle, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE) WinMove($Nhandle, "", 0, 0) While ProcessExists("webtms.exe") $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; Exitbutton ProcessClose($pid) _ProcessCloseEx("webtms.exe") ExitLoop Case Else ; enter other code here EndSelect WEnd Func _ProcessCloseEx($sPID) If IsString($sPID) Then $sPID = ProcessExists($sPID) If Not $sPID Then Return SetError(1, 0, 0) Return Run(@ComSpec & " /c taskkill /F /PID " & $sPID & " /T", @SystemDir, @SW_HIDE) EndFunc Func _RunFromSubfolder(Const $sFile, Const $sFolder) Local $sMessage = '' Local $iError = 0, _ $iExtd = 0, _ $iPID = 0 Local Const $aItems = _FileListToArrayRec($sFolder, $sFile, $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) If @error Then $iError = @error $iExtd = @extended Else $sMessage = StringFormat($g_sFileMsg, $sFile, $sFolder, $aItems[1]) $iExtd = $aItems[0] $iPID = Run($aItems[1]) If @error Then $iError = $RFS_ERROR_RUN $iExtd = @error EndIf ConsoleWrite($sMessage) EndIf Return SetError($iError, $iExtd, $iPID) EndFunc ;==>_RunFromSubfolder
Nine Posted August 29, 2019 Posted August 29, 2019 Have you tried making it work with another application (one that we can actually run and test) ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now