Jump to content

anthonyjr2

Active Members
  • Posts

    265
  • Joined

  • Last visited

  • Days Won

    1

anthonyjr2 last won the day on January 12 2017

anthonyjr2 had the most liked content!

1 Follower

Recent Profile Visitors

397 profile views

anthonyjr2's Achievements

Universalist

Universalist (6/7)

26

Reputation

  1. Everything I saw online was saying to not use a mapped drive, as UNC paths would be ideal for admin scripts. The share has access set to "Everyone" so I don't think it would have been a permissions issue. However, I did some further googling and turns out adding EnableLinkedConnections as a key to the registry in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" and restarting the PC fixed the problem. Something to do with allowing access to network locations in elevated processes. Thanks for the tip though, I will try mapping drives in the future if I run into other problems.
  2. Hi, I have a script that is getting all files in a directory on a network share, and listing them so I can move them to another folder. The script works fine normally, however I need to run this script as administrator, and for some reason _FileListToArray() returns an error code of 1 when the script is running in admin mode. Can't seem to find a reason for this online, anyone know why this would be happening? $ftpList = _FileListToArray("\\dev-pc\Get\", "*.txt", 1) ;get list of all files in share directory (files only flag) If @error Then logToFile("Error getting file list, err: " & @error) EndIf For $fName In $ftpList FileMove("\\dev-pc\Get\" & $fName, "\\dev-pc\Get\Archive\" & $fName) ;loop through files (should only be 1) and move to archive in share If @error Then logToFile("Error moving existing file " & $fName & " to archive") EndIf logToFile("Moved file " & $fName & " to archive") Next Thanks for any advice
  3. Not sure if you saw the COM error I posted, but it seems to be a range issue, rather than me being on the wrong tab or something. I made those changes but it still doesn't work. EDIT: Alright, I sorted it first and that seems to allow me to filter it. Man this stuff really bugs me sometimes lol.
  4. I'm back for yet another Excel issue. Here's my code: $oExcel = _Excel_Open(True, False, True, False, True) $newExcel = _Excel_BookNew($oExcel, 2) ;$pExcel is a BookOpenText from earlier that has been populated with data _Excel_SheetCopyMove($pExcel, Default, $newExcel, 2, False) _Excel_BookClose($pExcel, False) _Excel_FilterSet($newExcel, 3, Default, 36, "=U", $xlFilterValues) $oRange = $newExcel.ActiveSheet.UsedRange.SpecialCells($xlCellTypeVisible) Local $aResult[1][$oRange.columns.Count], $aContent ; Read the data of all Ranges in the Area and concatenate the returned arrays. For $oArea In $oRange.Areas $aContent = _Excel_RangeRead($newExcel, Default, $oArea, Default, True) _ArrayConcatenate($aResult, $aContent) Next _Excel_RangeWrite($newExcel, 1, $aResult) _Excel_BookSaveAs($newExcel, @ScriptDir & "\test.xlsx", Default, True) _Excel_BookClose($newExcel) _Excel_Close($oExcel) No matter what range I try to use I keep getting: "C:\script.au3" (117) : ==> The requested action with this object has failed.: $oRange = $newExcel.ActiveSheet.UsedRange.SpecialCells($xlCellTypeVisible) $oRange = $newExcel.ActiveSheet.UsedRange^ ERROR It seems to be an issue with $xlCellTypeVisible since other SpecialCells values work fine. Also I'm using Excel 2007, which is old but still supposed to have this functionality. Any suggestions? Or just a way to copy out this data from the filter if this snippet from the wiki won't work. EDIT: Adding in COM error I'm getting, not sure why it's happening still though script.au3 (113) : ==> COM Error intercepted ! err.number is: 0x80020009 err.windescription: Exception occurred. err.description is: Microsoft Office Excel cannot create or use the data range reference because it is too complex. Try one or more of the following: • Use data that can be selected in one contiguous rectangle. • Use data from the same sheet. err.source is: Microsoft Office Excel err.helpfile is: C:\Program Files (x86)\Microsoft Office\Office12\1033\XLMAIN11.CHM err.helpcontext is: 0 err.lastdllerror is: 0 err.scriptline is: 113 err.retcode is: 0x800A03EC
  5. I've been having this issue for like 3 hours today, and no searching has given me any solution. The SQLite.au3 UDF keeps returning $SQLITE_MISUSE when I try to use _SQLite_SQLiteExe(), and I can't seem to get to the bottom of it. I found a thread relating to my issue but apparently I don't have permission to view the updated functions that Melba posted. Here's my code: #include <SQLite.au3> Func importCSV($file, $dbFile) ; import (using SQLite3.exe) Local $sIn, $sOut, $i, $sCreate = "CREATE TABLE TblImport ("; For $i = 1 To _StringCountOccurance(FileReadLine($file, 1), ",") + 1 $sCreate &= "Column_" & $i & "," Next $sCreate = StringTrimRight($sCreate, 1) & ");" $sIn = $sCreate & @CRLF ; Create Table $sIn &= ".separator ','" & @CRLF ; Select "," as Separator $sIn &= ".import '" & $file & "' TblImport" & @CRLF _SQLite_SQLiteExe($dbFile, $sIn, $sOut, @ScriptDir & "\sqlite3.exe", True) If @error = 0 Then ;Show Table (using SQLite3.dll) Local $iRows, $iColumns, $aRes _SQLite_Startup() ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) _SQLite_Open($dbFile) _SQLite_GetTable2d(-1, "SELECT ROWID,* FROM TblImport;", $aRes, $iRows, $iColumns) _SQLite_Display2DResult($aRes) ; Output to Console _SQLite_Close() _SQLite_Shutdown() Else If @error = 2 Then ConsoleWrite("ERROR: sqlite3.exe file not found" & @CRLF) Else ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @CRLF) EndIf EndIf EndFunc For background info, I'm running this in x64 mode, the .exe is in the same directory as my script, I have both (x86 and x64) sqlite dlls in this same directory, and I'm not importing SQLite.dll.au3. My problem happens on the line "_SQLite_SQLiteExe($dbFile, $sIn, $sOut, @ScriptDir & "\sqlite3.exe", True)" which returns @error=2, and following the code in the UDF means it for some reason can't find my executable. I'm probably missing something stupidly obvious, but figured I'd try posting here first instead of driving myself insane over this. EDIT: Nevermind, seems my SQL query was incorrect. No idea why it was returning an error code of 2 if that was the case though.
  6. Doh, I figured there was something like that but didn't see it on the AutoIt help file since it only mentioned stuff about Delimited files. Found what I needed, thanks for the quick reply water.
  7. Do you have the .dlls for the architecture you're trying to run in the correct folder? This UDF is super finicky when it comes to seeing the libraries.
  8. Hey everyone, Recently started using AutoIt at work again and came up with this interesting problem. I'm trying to import a .txt file in Fixed Width mode, except the columns need to be slightly modified before the import completes. Usually this would be done by moving them over in the wizard, but I don't see if there is a way to do this automatically through AutoIt. I would rather not have to do it using MouseMove() on the import wizard but if that is my only solution that's what I will end up doing. I'm currently using _Excel_BookOpenText($oExcel, @ScriptDir & "\419.txt", Default, $xlFixedWidth) Which opens the file with incorrect column widths. I can't seem to find an option in the UDF to be able to change the widths of the column at all. They will always be the same size so if there was a way for me to just hardcode the width number in I could do what I need. Any suggestions/Is this possible? Thanks for any help.
  9. @Cascraft10 The line should be: ShellExecuteWait("C:\Program Files (x86)\Tesseract-OCR\tesseract.exe", $capture_filename & " " & $ocr_filename, "", "", @SW_HIDE)
  10. Yeah you're right, I was still half asleep when I wrote that so I didn't consider the other edge possibilities
  11. That user has not posted for over a year, so you are most likely out of luck. Unless someone comes around and rewrites a similar UDF there will probably not be a 64-bit update.
  12. My guess is the DisplaySwitch binary maybe switched to being 64-bit? Try adding this to the top of your script: #AutoIt3Wrapper_UseX64=Y
  13. Thanks both of you, exactly what I needed. You'd think taking a Formal Languages course would have me understanding regular expressions better, but I guess I need some more practice
  14. You can use _Now() by itself that does exactly what you want. Send(_Now()) EDIT: Just saw that you're also adding 3 hours to the time. In that case I recommend grabbing the @HOUR macro and then converting it to normal time by subtracting 12 if necessary. Something like: $hr = @HOUR $am = True If($hr > 12) Then $hr = $hr - 12 $am = False EndIf You should be able to do something similar to that and incorporate it into your code.
  15. Hi guys, I am pretty bad with regex, and am having some trouble trying to come up with an expression for a certain type of string. Basically I want to be able to tell if a string is of the format: AA#####A Where the A's are any letter from A-Z and the #'s are any digit from 0-9. I've been playing around with a regex tester online for a while but I can't really seem to grasp the concept very well. Could anyone give me any tips? This isn't exactly an AutoIt specific question which is why I didn't post it in General Help & Support.
×
×
  • Create New...