1. Need Help With Windowing & INI Files
- Posted by brian_keene at yahoo.com Aug 20, 2001
- 421 views
Hi All: As I stated previously, I'm new to EU & this group. "reviously I've been using another much simpler scripting language called AutoIt. Even though it's simpler, it can do several things very easily that I haven't found a way to do (easily) with EU. They are: 1. Read & write INI files. The w32ini library in the archive allows you to read & write INI files. But not when you want to read all of the entries in a "Program" area & don't know how many there are, & how big the entries are. In AutoIt I can do: SetEnv, CNT, 1 Repeat, 0 IniRead, HOSTS[%CNT%], hosts.ini, Hostnames, %CNT% IfEqual, ERRORLEVEL, 1, Goto, End EnvAdd, CNT, 1 EndRepeat End: SetEnv, HOSTS[0], %CNT% When the key names are #'s I can get any # of hostnames from the INI file without knowing how many there are, or how many bytes are needed for each entry. Can anyone tell me how to do something similar with EU? 2. AutoIt was designed to help with the automation of windows based installation programs (installshield, etc). To this end, you can identify if a window exists or is the active window by matching on not only the window title, but text that is inside of the window as well. EU with the windows.ew library (in the archvie agian) can do most of this except differentiate between 2 windows that have the same title but different text inside the window. Can someone tell me how to do this with EU? Thanks In Advance for any help. Regards Brian Keene
2. Re: Need Help With Windowing & INI Files
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 21, 2001
- 394 views
----- Original Message ----- From: <brian_keene at yahoo.com> To: "EUforum" <EUforum at topica.com> Subject: RE: Need Help With Windowing & INI Files > I don't have the SDK. So any help would be much appreciated. Hi Brian, here is a little program that lists all the window text in the system. ------------------ include win32lib.ew without warning integer win, lst1, SB constant xEnumWindows = registerw32Function(user32, "EnumWindows", {C_ULONG, C_ULONG}, C_ULONG) constant xEnumChildWindows = registerw32Function(user32, "EnumChildWindows", {C_ULONG, C_ULONG, C_ULONG}, C_ULONG) atom rc win = create(Window, "All Window Text", 0, 0, 0, 400, 400, 0) SB = create(StatusBar, sprintf("Win32lib v%d.%d(%d)", {Win32LibVersion[1], Win32LibVersion[2], Win32LibVersion[3] }) , win, 0, 0, 0, 0, 0) lst1 = create(List, "List of text items found", win, 5,5, 350, 340, 0) integer wcnt, ccnt wcnt = 0 ccnt = 0 function gettext(atom hWnd) atom tlen sequence text atom tbuf, tbuflen tlen = w32Func(xSendMessage, {hWnd, WM_GETTEXTLENGTH, 0, 0}) if tlen > 0 then tlen += 1 tbuf = acquire_mem(0, tlen) tbuflen = w32Func(xSendMessage, {hWnd, WM_GETTEXT, tlen, tbuf}) text = peek( {tbuf, tbuflen}) release_mem(tbuf) else text = "" end if return text end function function enumcw(atom hWnd, atom lParam) sequence text ccnt += 1 text = gettext(hWnd) addItem(lst1, sprintf("%4d %4d %s", {wcnt, ccnt, text})) return 1 end function function enumw(atom hWnd, atom lParam) atom rc sequence text ccnt = 0 wcnt += 1 text = gettext(hWnd) if length(text) > 0 then addItem(lst1, sprintf("Parent text '%s'", {text})) rc = w32Func(xEnumChildWindows, {hWnd, call_back(routine_id("enumcw")), 0}) end if return 1 end function rc = w32Func(xEnumWindows, {call_back(routine_id("enumw")), 0}) WinMain(win, Normal) ---------------- cheers, Derek