Jump to content

anthonyjr2

Active Members
  • Posts

    265
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by anthonyjr2

  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.
  16. Meant to also tag the user @Graeme so he sees this
  17. I can't test it myself but did you try: _ArrayAdd($aArray,$item.ModifyDate)
  18. @Danp2 I'll give that a shot when I get a chance. @Juvigy Do you mean doing it the way Danp2 suggested?
  19. For the future, please use the code tags (<>) in the editor when posting code, it makes it a lot easier for us to read. If the position of the click changes, it is most likely that the other system has a different resolution than the one you recorded on. A different resolution means a different click location.
  20. Hey everyone, Since I haven't yet created anything that isn't specific to my job, and haven't ever posted any examples, I figured I would share this little script I made a while ago for fun between projects. #include <GUIConstants.au3> #include <Misc.au3> HotKeySet("{F9}", "Start") HotKeySet("{ESC}", "Stop") Func Start() Local $hGUI = GUICreate("Transparent GUI", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Local $i,$j GUISetBkColor(0) WinSetTrans($hGUI, "", 50) GUISetState(@SW_SHOW, $hGUI) For $i=0 To 1040 Step 1 _Middle($hGUI, "", @DesktopWidth-$i, @DesktopHeight-$i) $winCoord = WinGetPos($hGUI) _MouseTrap($winCoord[0],$winCoord[1],($winCoord[0] + $winCoord[2])-5,($winCoord[1] + $winCoord[3])-5) Next For $j=0 to 840 Step 1 _Middle($hGUI, "", @DesktopWidth-$i-$j, @DesktopHeight-$i) $winCoord = WinGetPos($hGUI) _MouseTrap($winCoord[0],$winCoord[1],($winCoord[0] + $winCoord[2])-5,($winCoord[1] + $winCoord[3])-5) Next ToolTip("Your mouse has been trapped!", @DesktopWidth/2-80,@DesktopHeight/2+22) While 1 Sleep(10) WEnd EndFunc ;==> While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _Middle($win, $txt, $width=-1, $height=-1) If $width >= 0 Or $height >= 0 Then Local $aWin = WinGetPos($win) If $width < 0 Then $width = $aWin[2] If $height < 0 Then $height = $aWin[3] WinMove($win, $txt, $aWin[0], $aWin[1], $width, $height) ; first winmove EndIf Local $size = WinGetClientSize($win, $txt) Local $y = (@DesktopHeight / 2) - ($size[1] / 2) Local $x = (@DesktopWidth / 2) - ($size[0] / 2) Return WinMove($win, $txt, $x, $y) ; second winmove EndFunc ;==>_Middle Func Stop() _MouseTrap() Exit EndFunc ;==>Stop It creates a transparent GUI that slowly shrinks, trapping your mouse inside! I created it after discovering the _MouseTrap() function in the helpfile and the idea floated into my head. It has no real purpose other than entertainment. I figured between all of the serious scripts we use here a little fun is always a nice break F9 to start, ESC to exit at any time. If this is against the rules feel free to remove it, I didn't see any place this would fall under.
  21. Yes that's what you need to do.
  22. For the record, I don't think AutoIt is the correct language for something like this. You probably want some sort of web programming such as Javascript.
  23. If you want that to happen automatically then you would probably have to enable AutoPlay in the steps that Jlogan described. Most of the stuff you want seems to me like it could be done in AutoIt, but getting the program to automatically run may be the more complicated part.
  24. I would say you need some way to communicate between your phone and your PC. I doubt AutoIt would be of any use in this communication though, so we probably won't be of much help here. You would have to create an Android app of some sort that is able to communicate with the server.
  25. While it is a slightly different approach than how you did it, this way works and doesn't require any conversion of hex. #Include <String.au3> MsgBox (0, "Seven keyboard shortcuts for Idiom translators, version 4", "Shift+Ctrl+Space = non-breaking space (e.g. between digits and SI symbols, ""5 cm"")" & @CRLF & "Alt+Ctrl+fullstop = ellips (...)" & @CRLF & "Ctrl+NumMinus = en-dash" & @CRLF & "and also Ctrl+hyphen = en-dash" & @CRLF & @CRLF & "Ctrl+( = single opening quote" & @CRLF & "Ctrl+) = single closing quote (or curly apostrophe)" & @CRLF & "Ctrl+Shift+( = double opening quote" & @CRLF & "Ctrl+Shift+) = double closing quote" & @CRLF & @CRLF & "Some shortcuts may not work in a browser text field." & @CRLF & @CRLF & "To exit the program or to disable the shortcuts, click the round blue icon in the system tray.", 0) HotKeySet("+^{SPACE}", "nonbreakspace") HotKeySet("^{NUMPADSUB}", "endash") HotKeySet("^-", "hyphdash") HotKeySet("!^.", "ellips") HotKeySet("^9", "singleopen") HotKeySet("^0", "singleclose") HotKeySet("^+9", "doubleopen") HotKeySet("^+0", "doubleclose") While 1 Sleep(100) WEnd Func nonbreakspace() Send (" ",1) EndFunc Func endash() Send ("–",1) EndFunc Func hyphdash() Send ("-",1) EndFunc Func ellips() Send ("…",1) EndFunc Func singleopen() Send ("‘",1) EndFunc Func singleclose() Send ("’",1) EndFunc Func doubleopen() Send ("“",1) EndFunc Func doubleclose() Send ("”",1) EndFunc I just put each alt code into the send and sent it raw. From my testing it seems to work just as well.
×
×
  • Create New...