Jump to content

kadanefewi

Members
  • Posts

    16
  • Joined

  • Last visited

kadanefewi's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Try reading all files in binary (will work for binary and text). Local $hfile = FileOpen($filePath, 16) Local $data = FileRead($hfile) FileClose($filePath)
  2. Hey Spud, thanks. Yes, I'm doing that, but this is a blacklist match, meaning I need to remove several extensions from a _FileListToArrayRec, to I had to come up way to filter on several conditions. See my other reply for what was the problem.
  3. Hey man! You always reply to my posts, thank you. I was going to answer your question, but I started thinking about this... I have several conditions that might impact in whether the file is matched or not, not just this, it's another list. The problem was that I have a list of conditions that I took from a .txt file and converted to a binary string (if that's a thing). This ".txt" is one of them. I had several such lists, obtained from different strings. The problem was that some were formatted with Windows, other Linux EOL. I used @CR to populate the array from the string, because @CRLF failed with another array, so I didn't think much about it and just used it for all. So, basically I was telling autoit to match on ".txt" & @LF, that's why it wasn't finding the match. Thank you!
  4. Hey people. I'm iterating over a list of files from all drives and want to know if it matches on a certain extension. I'm getting a 0 (no match), where there clearly is a match. For $i = 1 To $aFiles[0] $exceptionIndex = StringInStr($aFiles[$i], ".txt") If $exceptionIndex > 0 Then ;do stuff EndIf Next This is happening on a drive which is a VirtualBox mounted CD (this case the VirtualBox tools). It's read only. I'm mentioning it because I had some strange behavior on VirtualBox mounted drives in the past (memory leaks when iterating over mounted VirtualBox shared folders). Has anyone seen any similar issues? Have the same problem if I use StringRegExp.
  5. Basically I'm doing a very resource intensive file search in disk and every 5 seconds I need to check for a condition (basically a command to stop the search). $timer = _Timer_Init() For $i = 0 To $aFilesListSize - 1 ;;do work here If _Timer_Diff($timer) > 5000 Then $timer = TimerInit CheckIfStopRequested() EndIf Next I assume checking a timer difference is pretty resource intensive, compared to a simple int value check. So I thought about doing something like this. $counter = 0 $timer = _Timer_Init() For $i = 0 To $aFilesListSize - 1 ;;do work here $counter = $counter + 1 If $counter > 25 Then $counter = 0 If _Timer_Diff($timer) > 5000 Then $timer = TimerInit CheckIfStopRequested() EndIf EndIf Next From my benchmarks, 25 iterations of the loops are roughly 1 to 3 seconds. What do you think? Am I over optimizing? It's hard to measure the impact of each version, so any input would be appreciated.
  6. Thanks everyone! Been looking into it, is there a way to code the behaviour from /ErrorStdOut into the script itself or do I need to call it with that parameter?
  7. Hi, I'd to save the exception message to a file and exit without showing a GUI element with the error information. I'm working remotely on a Windows server via console and can't see GUI elements. Is this possible?
  8. I was reviewing the code to post it here... I'm not a smart man, I was closing the bat and not the main exe! Was calling the wrong variable, thanks for the help, you made me realize my mistake!
  9. Hey people. I want to keep running a process executed by the main compiled script after I kill the process, using ProcessKill. The problem is that after killing the parent process, the children is also terminated. I tried using Run, ShellExecute (what I need to run are batch commands BTW). Anyway to prevent this behavior? All I can think of is creating a scheduled task to keep it alive after closing the main one, but it might be unreliable, depending on the system.
  10. Hey guys. I need to obtain the line number where a given string was found, I couldn't find a function. All I can think of is counting the number of CR & LF characters, would that work? How can I represent them to Autoit, if that's the best solution? Thanks for the input.
  11. Good afternoon. I'm trying to use it to run either rar.exe or 7z.exe to decompress from command line a few files, but I'm not able to pass arguments to those 2 executables using this command: $iNewPID = _RunBinary($bBinary, " x test.rar") The same structure to pass arguements to a command line executable works fine with other executables that I've tested, but there's something particular about these 2, which I don't know what it is, that makes them show me the parameters information (similar to running rar -help, for example). Any ideas on how to solve them? If for instance I load from memory cmd.exe and then call rar.exe, it works, but it's not what I'm intending to do. Thanks.
  12. Hey! I'd like to be able to package a folder, keeping it's structure of subfolders and files, using only internal AutoIt functions or Windows Vista and above APIs. I don't want to use an external program, such as rar.exe or 7zip.exe. I can easily do it that way, but I'd like to use only included tools. I've searched the help files and the forums, on the help files I've found nothing; on the forums, only this, which is an amazing work, but it's very heavy and depends on 7zip: '?do=embed' frameborder='0' data-embedContent>> Am I missing some obvious compression algorythm? I know what I'm asking is hard to do, I don't think there's a clear cut way to do it.
  13. OK, I'm one of those annoying guys that replies to his own question five minutes later, hahaha! Maybe useful for someone googling for that in the future! Anyway, pretty easy. Just make an array of all the files to convert using _filelisttoarrayrec. Then, use _StringToHex on each, output to a file. All I need to do is paste the hex code in the .au3 file and then use_HexToString to convert back and read the string. When I get time to do it, I'll post the code!
×
×
  • Create New...