Jump to content

IErrors

Members
  • Posts

    6
  • Joined

  • Last visited

About IErrors

  • Birthday 06/30/1982

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

IErrors's Achievements

Seeker

Seeker (1/7)

2

Reputation

  1. This is great - It's cool to see someone else interested in AS400 automation! A few years ago I developed an application for my employer that automated iSeries and wrote a massive library to operate on these PCOMM classes. I found that using the AutScreenDesc class was a very reliable way of waiting for a screen by first describing it then calling the WaitForScreen() method. Alternatively, the WaitForString() and WaitForStringInRect() methods work just as well. I also found the SetConnectionByHandle() method was a bit more reliable when dealing with multiple sessions. I wish I could share the lib, but unfortunately it technically doesn't belong to me Though IBM provides a wealth of knowledge on these classes here and even provide VB example code which makes it super easy to translate into AU3.
  2. Thank you both Mikell & LarsJ! I figured it had to do with the registered hTarget, but I wanted to make sure I wasn't doing it wrong. I was able to get the active window and control handle in the message handler of my actual code - although very fumbly. I hadn't thought of creating individual callbacks for each control - This is a great! Thank you for demonstrating the correct way of doing this.
  3. Of course! That's how I am doing it and it works just fine! - Thanks. I was wondering if the $hWnd param of the WM_INPUT message handler should reflect the actual window handle the message was received in, because it stays the same no matter what form I type in.
  4. Looks like you lack the rights to install fonts - which requires writing to the registry and creating files in a system directory so it doesn't surprise me. You will need to run this at an elevated level. .... Or you could just register the fonts for your current session using GDI+. The font's will work like they are installed until you log off. -- Look at _WinAPI_AddFontResourceEx()
  5. I am working on some functionality to detect whether a standard keyboard was used for input in my UI or if a barcode scanner (that acts like a keyboard) was used. Instead of dealing with a scanner SDK, I decided I would read from the raw input to get device info and make a determination. I discovered while testing with multiple UIs is that when the WM_INPUT message is received and the function called, the $hWnd param is always the same (apparently whatever handle I set the "hTarget" to in the RAWINPUTDEVICE struct). Is this normal behavior?? Using the test code below, no matter what window you give input to the $hWnd param never changes. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPISys.au3> $Form1 = GUICreate("Form 1", 300, 300, -1, 10) ConsoleWrite("$Form1 = " & $Form1 & @CRLF) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 300) GUISetState(@SW_SHOW, $Form1) $Form2 = GUICreate("Form 2", 300, 300, -1, 350) ConsoleWrite("$Form2 = " & $Form2 & @CRLF) $Edit2 = GUICtrlCreateEdit("", 0, 0, 300, 300) GUISetState(@SW_SHOW, $Form2) GUIRegisterMsg($WM_INPUT, "WM_INPUT") ; https://msdn.microsoft.com/en-us/library/ms645590(v=vs.85).aspx $tRID = DllStructCreate($tagRAWINPUTDEVICE) ; https://msdn.microsoft.com/en-us/library/ms645565(v=vs.85).aspx DllStructSetData($tRID, "UsagePage", 1) DllStructSetData($tRID, "Usage", 6) DllStructSetData($tRID, "Flags", 0) DllStructSetData($tRID, "hTarget", $Form1) ; According to the struct def, if hTarget=NULL then it should follow keyboard focus. - nope :( $pRID = DllStructGetPtr($tRID) _WinAPI_RegisterRawInputDevices($pRID) ; https://msdn.microsoft.com/en-us/library/ms645600(v=vs.85).aspx Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_INPUT($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite("hWnd = " & $hWnd & " | Title = " & WinGetTitle($hWnd) & @CRLF) ConsoleWrite("Active Window = " & WinGetTitle("[ACTIVE]") & @CRLF) Return $GUI_RUNDEFMSG EndFunc ;==>WM_INPUT
  6. Hi everyone. I am rather new to AutoIt AND MCI so please forgive me if I am just doing something completely stupid here. I am having an issue with the script below. It is used to set hotkeys for a-z and play a random wav file at key press. It seems to work fine for about 7 moderately spaced out keystrokes then just absolutely refuses to play anymore. _SoundPlay() returns 1 "Play Failed" and sometimes _SoundStatus() Returns 0 when the playing stops. Any idea what is going on here? Am I just completely overloading MCI? Is that even possible? Any help would be great! #include <Array.au3> #Include <File.au3> #include <Sound.au3> AutoItSetOption("SendKeyDelay", 0) Reg_MCI_Files() $Num = 0 $i = 97 Dim $Letters[26] ;~ 97 - 122 a-z Do $Letters[$Num] = Chr($i) $num = $num + 1 $i = $i + 1 Until $i = 123 For $i in $Letters HotKeySet($i, "Play") Next While 1 Sleep(100) WEnd Func Play() Hotkeyset(@HotKeyPressed) Send(@HotKeyPressed) Hotkeyset(@HotKeyPressed, "Play") Do $R = Random(1, $Files[0], 1) ConsoleWrite(_SoundStatus($Audio[$R]) & @CRLF) Until _SoundStatus($Audio[$R]) = "stopped" ConsoleWrite(_SoundPlay($Audio[$R]) & " " & @error & @CRLF) EndFunc Func Reg_MCI_Files() Global $Files = _FileListToArray(@ScriptDir, "*.wav", 1) _ArrayDisplay($Files) Global $Audio[$Files[0] + 1] $i = 0 For $File in $Files $Audio[$i] = _SoundOpen($File) $i = $i + 1 Next $i = "" EndFunc
×
×
  • Create New...