Jump to content

handofthrawn

Active Members
  • Posts

    27
  • Joined

  • Last visited

handofthrawn's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. My script below was working as of last week but now the book won't attach. The first error code is 1 for the book attach, @extended = -2147352570. When I do the rangeread, it confirms the first error code with a 1 return. I do have two excel sheets running but I didn't think it would matter because the book was attached to the file I want. I've read the help file, tried the example scripts, even had this script working but now its broken. My autoit is up to date. Any ideals? Thanks. #include <Misc.au3> #include <Excel.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #include <MsgBoxConstants.au3> AutoItSetOption("WinTitleMatchMode", 2) WinActivate("Morning IND") Global $sWorkbook = @DesktopDir & "\Morning IND.xls" Global $oExcel = _Excel_BookAttach($sWorkbook) ; Path to excel file that is on the desktop If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $var1 = _Excel_RangeRead($oExcel, Default, "X47") ; Symbol from X1 If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
  2. Water I bet you are right. I will try that and if I still have issues I will reply back. Thanks for the help!
  3. I have an excel sheet open and I'm trying to use _ExcelBookAttach. However, sometimes when I use the script it tries to open up the file again. Its giving the same action as if I double clicked the icon to open up the file and get that popup about it being locked for editing by the User. I have this excel file start with my computer since I need it for work. However, the weird thing is that when I shut it down and re-open it and try the script again it works. It attaches fine and I'm able to read cells. Does anyone know what could be causing this type of action? Is there a way to insert code to see the error or action it performed and why? Below is my test script I used where I still got the error. Thanks for any help. #include <Misc.au3> #include <Excel.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> Local $oExcel = _ExcelBookAttach(@DesktopDir & "\Morning IND.xls") ; Path to excel file that is on the desktop Exit
  4. Thanks so much InunoTaishou! I feel so stupid now because my manual fix was to set each one not thinking I could use the autosize on each one too.
  5. I did figure out I can do each one manually though but I can't use the autosize feature then.
  6. Thanks for the help! Sadly I still have one problem. That line only stretched the first column, "Column" but did not do the rest for "Item", ""PCI", and "IDE". I tried reading through the _GUICtrlListView_SetColumnWidth parameters and example but couldn't figure out where I was going wrong.
  7. I am trying to adjust my top column so the column topics are centered and using a bigger font. However, whenever I use a bigger font the columns stay the same size and I just get a ",,," Does anyone know how to stretch the columns to use the entire box, center it, and increase the font size? Thanks for any help. #include <Misc.au3> #include <Excel.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Indications", 410, 280, 590, 85, -1, $WS_EX_ACCEPTFILES) ; Size of box GUISetBkColor(0x00E0FFFF) ; will change background color Local $idListview = GUICtrlCreateListView(" Column | Item | PCI | IDE ", 5, 5, 395, 210) ;,$LVS_SORTDESCENDING) GUICtrlSetFont($idListview, 12) ;GUICtrlSetFont($idListview, 18) ; Font size I would like to use Local $idButton = GUICtrlCreateButton("Close", 150, 220, 90, 55) ; CLOSE BUTTON Local $idItem1 = GUICtrlCreateListViewItem("item211|col22|col23|col34", $idListview) Local $idItem2 = GUICtrlCreateListViewItem("test111|test31|test5|test6", $idListview) GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping GUISetState(@SW_SHOW) ;GUICtrlDelete($idItem1) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton ExitLoop Case $idListview EndSwitch WEnd
  8. Wow, so simple I feel like an idiot :/ Thanks for hleping me out boththose. Have a great day.
  9. I have words like ABCa.AB DEFb.AB GHIa.AB I need to change those to ABC.A-AB DEF.B-AB GHI.A-AB Right now I manually do it with stringreplace, for example $desiredString = StringReplace($desiredString, "ABCa.AB", "ABC.A-AB") I was wondering if there was a way to search for all the undercase letters and change it to an uppercase with a "." before it and a "-" after it? I only have "a" and "b" to look for so maybe just change all "a." to ".A-". Is there a way to do this? Thanks for any help as I'm still figuring this scripting out.
  10. I have a script that starts up all my work programs. Programs like ventrilo, trillian, and other work stuff. In the past week, I noticed two of these programs not starting up while 6 of them work the same. I investigated and I notice these only start when I run the script as administrator (or add #requireadmin). I use windows 7 and have no UAC. I have not changed anything to my OS except install updates. I'm so confused why only some of these programs now start up and require admin. If I double click the executable or run in command prompt, they startup fine. Does anyone have a clue what happened to cause this change and if I can change it back? Below is the code I ran as a test. Only the last program now starts up unless I add #requireadmin or right click and run the script as admin. Thanks for any help. #include <Misc.au3> RUN("C:\Program Files\Ventrilo\Ventrilo.exe") Sleep(1000) RUN("C:\Program Files (x86)\Trillian\trillian.exe") RUN("C:\Program Files (x86)\Stealth Alerts\SAClient.exe") ; This works just fine
  11. Exit, that did it! Thanks so much. Mikell, thanks for the tip. I knew there was a one line solution out there to remove duplicates but I would have never guessed to use a NOT with Stringinstr. This stuff is slowly turning from gibberish to code I can read and for that I thank you.
  12. Exit, that works but I'm screwing up your result because I need the format slightly changed. I'm trying to get the result into notepad without the [0], [1]. [2]. so it looks just like this: STWD RDS.A COP CVX B ... And I'm also trying to remove the duplicates (exactly like the excel duplicate removal feature where it removes the duplicates, keeps the unique words, and sorts it out so there are no gaps in between). My code above got close to achieving this but it fell flat on words with a "." I've tried to copy some for loops and use arrayunique but I'm messing up slightly and just can't nail the result.
  13. I am revisiting this because I found an error in my current script. I was trying to remove duplicates but I ran into issues when a word has "." in it or I have a single letter word. The line I am trying to fix is: dim $pattern = "(bw+ B)" This is supposed to grab a word but when I have a word like RDS.A (in my FlyNews.txt file), it separates it into two. When I tried to use this line of code to fix it dim $pattern = "(bw.+ B)" That caused me to lose single letter words like B. If anyone has any suggestions I would greatly appreciate it. Thanks. #include <array.au3> #include <Misc.au3> $sText = FileRead("FlyNews.txt") $a = StringRegExp($sText, 'EDTh+([$.A-Z,' & Chr(32) & ']+)', 3) $res = "" For $i = 0 to UBound($a)-1 If StringStripWS($a[$i], 3) = "" Then ContinueLoop ; this excludes empty lines $tmp = StringRegExp($a[$i], '([^s,]+)', 3) For $j = 0 to UBound($tmp)-1 $res &= $tmp[$j] & @crlf Next Next $emptyfile = FileOpen("results.txt", 2) FileClose("results.txt") FileWrite("results.txt", $res) $string = FileRead("results.txt") $emptyfile = FileOpen("results.txt", 2) FileClose("results.txt") dim $pattern = "(bw+ B)" dim $return = StringRegExp($string, $pattern, 3) dim $obj = ObjCreate("System.Collections.ArrayList") For $i = 0 To UBound($return) -1 If Not $obj.Contains($return[$i]) Then $obj.Add($return[$i]) Next dim $cleared = '' For $word In $obj $cleared &= $word & @crlf Next FileWrite("results.txt", $cleared) p.s. UEZ, I tried your code but its throwing me an error syntax on that $ssLine where the "? is at. FlyNews.txt results.txt
  14. This may not help but when I'm having trouble with a script I slow it down and throw in tons of breaks (Msgbox popups). Try changing the sleeps to 500 or even 5000 and see how many times you can get it to run correctly. If a certain part breaks no matter the speed, try doing it in another manner (mouseclick + send instead of controlsend?). Good luck.
×
×
  • Create New...