audioman Posted May 8, 2020 Author Share Posted May 8, 2020 Hello Nine. Shame on me! I was thinking that the compiled script would be started each time (run as Administrator) then the hot key combination. Your approach is the right one. Now I'm wrestling with 2 other problems. First, I have the excel spreadsheet open on the desktop but when I start the compiled script, a second instance of the spreadsheet opens. This, of course, generates an error. If I close this second spreadsheet then use the hot key combo, the chosen row is displayed as expected. Naturally, I don't want this second instance. I suppose this could be a Windows 10 problem and not the script. My second problem is that I'm trying to use the script to send the captured row information to another app which is open on the desktop. I've been able to do that with the script posted by Subz so I know my code works. Any answers would be appreciated. Link to comment Share on other sites More sharing options...
Nine Posted May 8, 2020 Share Posted May 8, 2020 Use _Excel_BookAttach instead of _Excel_BookOpen. That will solve your first issue. For the second problem, post the code you have, so I can look to it. Crystal ball is out of service... “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
audioman Posted May 8, 2020 Author Share Posted May 8, 2020 Thanks for the response. I made the change and am now getting this error: "E:\Newburyport\2020_personalizingForms\NBP-TestScript.au3" (20) : ==> Variable must be of type "Object".: Local $oRange = $oWorkBook.Activesheet.UsedRange.Rows($oExcel.ActiveCell.row) Local $oRange = $oWorkBook^ ERROR >Exit code: 1 Time: 13.14 Link to comment Share on other sites More sharing options...
Nine Posted May 8, 2020 Share Posted May 8, 2020 (edited) Do you have a reading problem ? Looks to me that you have difficulties to understand what we are suggesting you to do ? I will repeat, post your code, so we can help you and stop telling us stories that it doesn't work. Edited May 8, 2020 by Nine “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
audioman Posted May 9, 2020 Author Share Posted May 9, 2020 First, I understand perfectly - English is my native language. The error info I posted occurs when I run your code alone after making the change you suggested. However, the remainder of the script calls and inserts the captured data into a proprietary application and I'm very reluctant to post the code for it on a public site. The point is, and I repeat, this error occurs when I run your code by itself. I've attached your code modified per your instructions. NBP-TestScript2.au3 Link to comment Share on other sites More sharing options...
Nine Posted May 9, 2020 Share Posted May 9, 2020 (edited) I see, your _Excel_BookAttach is wrongly constituted. Please open help file and read carefully how the parameters are passed to the function. When you have issues within a script, add some error handling, it will help you understand what is going on... Edited May 9, 2020 by Nine “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
audioman Posted May 12, 2020 Author Share Posted May 12, 2020 I've tried compiling this script in both x86 and x64. It compiles without errors and runs when the .exe is run using Open or double click. However, when run as administrator a second blank Excel window opens and the program crashes (Line 3827 - Error: The requested action with this object has failed) when the hotkey combo is used. I need to run this script using the as administrator function. I've tried many, many changes without success. Any help would be appreciated. NBP-TestScript2.au3 Link to comment Share on other sites More sharing options...
Subz Posted May 12, 2020 Share Posted May 12, 2020 Try something like: (untested) Global $oWorkbook ;~ Try to attach to open workbook $oWorkbook = _Excel_BookAttach($sWorkbook) ;~ If unable to attach to the workbook, open the workbook If @error Then $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook) If @error Then Exit MsgBox(4096, "Error opening workbook", "Error occurred while trying to open: " & @CRLF & $sWorkbook) Link to comment Share on other sites More sharing options...
audioman Posted May 13, 2020 Author Share Posted May 13, 2020 Hi Subz: Thanks for your input. I was on the wrong track and have fixed my issue. Link to comment Share on other sites More sharing options...
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