
JohnD
Members-
Posts
12 -
Joined
-
Last visited
JohnD's Achievements

Seeker (1/7)
0
Reputation
-
Thanks MHz! It took a little tinkering bc I am new to this language but I got it working. I appreciate the help.
-
Sorry, that wasn't clear. It is @error returning 0, not 3.
-
Actually, the return value is 0, indicating success. I changed ULONG to UINT but it still doesn't place the text. The constant is declared along with there being a valid window handle, so I don't know what else it could be. $result = DllCall("user32.dll", "int", "Sendmessage", "hwnd", $Edithwnd, "UINT", $WM_SETTEXT, "WPARAM", 0, "LPARAM", "Hello World.")
-
Hi everyone. I am not able to get dllcall to work with send message. $result = DllCall("user32.dll", "int", "Sendmessage", "hwnd", $Edithwnd, "ULONG", $WM_SETTEXT, "WPARAM", 0, "LPARAM", "Hello World.") Anyone know what I am missing here? This is for a control not in my application. Thanks. -JD
-
I know I can use the native function, but like i said I am eventually going to use this with controls outside of my application. Does anyone know what may be wrong with the above dllcall? thanks
-
Hey everyone. I could use some help with the correct usage of this API call. As I mentioned in my previous post I am just experimenting on my own GUI using API calls. That being said, I know I can do the same thing using the following: GUICtrlSendMsg($Edit1 , $WM_SETTEXT, 0, "Hello World.") But I will be eventually using this call on other application windows so I need to use the API. Here is what I have. $result = DllCall("user32.dll", "int", "Sendmessage", "hwnd", GUICtrlGetHandle($Edit1), "ULONG", $WM_SETTEXT, "WPARAM", 0, "LPARAM", "Hello World.") I have a valid handle being returned for edit1. Any help is appreciated. Thanks. -John
-
Hi everyone. I'm still learning AutoIT, so I'm doing some experimenting. Can anyone give me advice on how I would go about getting the handle of a control that I created. I know there are plenty of functions built in to autoit for doing what I want to do (send text with API), but I wanted to see if it could be done the more tedious way. I guess I'm ultimately looking to stop using send(), and would rather use WM_SETTEXT(for external app interaction). Thanks! -John
-
If I am understanding correctly, the object is being derived from the already opened windows process. I haven't written any further code that what is above. I guess I just have a few questions. Since excelbookattach can only be used with an exact title match that is not an option for me. So, if I am to use WinActivate, and use its return value (which is a windows handle) - how then do I address the the excel application as far as using the functions in the excel udf? Also, I've seen a digital book for autoit on amazon. Is this worth purchasing? I'm wondering how best to get started. Thanks!
-
Salty, Thank you and everyone else for the contributions so far. I am still learning and I appreciate your patience. I am constantly back and forth to the help file trying to learn as much as I can, and obviously what you folks have been contributing has been enormously helpful. However, a few questions persist. So, I see from trial and error that what Mike said is true, for some reason the opt flag for in string matching does not apply for the excelbookattach function when used in Title mode. It does however work if you include the entire title in the first parameter. Progress. Secondly (perhaps this is directed to mike), when I attain the window handle from the running Excel application I am not able to process it as a object (i.e. $oExcel.application.caption). In other words, $oExcel.application.caption, when used with WinActivate and its parameters does not work. I get runtime errors for that line even though I have a valid handle. Now, I did it a slightly different way and was able to work with it as an object, using $oExcel = ObjGet("","Excel.Application") ; Get an existing Excel Object This is sort of an imprecise way of getting the window I want (should others be opened at the same time the program could grab the wrong one), however, it does return the object that I can work with, and employee Salty's work around. With this method I gain an object I can work with, but lose the flexibility of being able to discriminate between other excel processes, and with Mike's way I gain the ability to discriminate, but lose the ability of work with it as an object. Can there be a happy coexistence here? I'd like to have the functionality of being able to find the precise excel window (already opened) and work with it as an object. Still not there yet. Thanks for any help =]
-
WinActivate worked to retrieve the window's handle, but it still (for some reason) does not allow the other excel functions to execute. So, nothing is written to the cells via excelwritecell, nor is the application closed by excelbookclose. This is frustrating. #include <Excel.au3> #include <File.au3> Opt("WinTitleMatchMode", 2) $oExcel = WinActivate("week", "") ;$oExcel = _ExcelBookAttach("Microsoft Excel", "Title") ;with $s_mode = "Title" ==> Title of the Excel window _ExcelWriteCell($oExcel, "If you can read this, then Success!", 2, 2) ;Write to the Cell MsgBox(0, $oExcel, "Press OK to Save File and Exit") _ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes
-
Hello. Per the recommendation of another member of the forum I am attempting to use the Excel UDF's to navigate excel. I need to simple get the handle of the instance that is already running, in other words, I won't be opening the file using the full pathname and _excelbookopen. I was playing around with the example from the helpfile, and attempting to adapt it for my purposes. Here is what I have, but the $oExcel variable returns 0. #include <Excel.au3> #include <File.au3> Opt("WinTitleMatchMode", 2) $oExcel = _ExcelBookAttach("Microsoft Excel", "Title") ;with $s_mode = "Title" ==> Title of the Excel window _ExcelWriteCell($oExcel, "If you can read this, then Success!", 2, 2) ;Write to the Cell MsgBox(0, $oExcel, "Press OK to Save File and Exit") _ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes Can anyone clue me in to what I am doing wrong? Thanks.
-
Hello. I have a function that is being used to populate a cell or cells with data from another application (SAP). The function works as far as being able to navigate from one cell to the other, the problem is the delivery of the data into that cell. So, the problem is when the text is sent via the send command the cell in excel gets the cursor. Afterwards, a second send command is sent with just the enter key. This is intended to move down to the next row, but it doesn't The cell stays in edit mode and the next set of data is sent to that very same cell. I've tried slowing the function down to see if that was the problem and it isn't. My question is, how can I send text to the cell, have excel 'break out' of the 'cell edit' mode, and move to the next cell. It's odd, because to do this manually, it's one of the easiest things we do in excel. Thanks in advance. The code is pasted below for convenience, but the problem should be adequately described above. Func UpdateXLSCellsWithText($cellcolumn, $cellstart, $cellstop, $celldata) ;cellcolumn is the letter - I ;cellstart is the anchor, and the first cell ;cellstop is the total number of cells to populate ;celldata is the ra number Local $i Local $vActiveCell = $cellcolumn & $cellstart Local $cellcount = $cellstop ;total number For $i = 0 To (Number($cellstop) - 1) Step 1 SeekCell($vActiveCell) Send($celldata) ;this line and the next are ineffective for entering data. Send("{ENTER}") $cellstart += 1 $vActiveCell = $cellcolumn & $cellstart Next EndFunc ;==>UpdateXLSCellsWithText