Jump to content
OMGWTFLOLBBQ

Text to Array

Recommended Posts

OMGWTFLOLBBQ

Hello!

 I've been going through all of the help files and examples, but I feel lost. I can't seem to find what I need. Essentially, what I'm doing is simple(in my head).

Create a file based on the information needed, select a line in that file, then put that line back in DOS. My code is below, I know it's messy, but I'll take the heat if you can help.

 

;BitlockerUpdate
;2016.05.24

HotKeySet("{ESC}", "Terminate")

Run("C:\Windows\System32\CMD.exe") ;open command prompt
Sleep(500) ;sleep half second
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send("C:")
   Send("{ENTER}")
   send("CD{SPACE}%windir%\sysnative\")
   send("{ENTER}")
EndIf

;create file with Bitlocker Protectors
Send("manage-bde.exe{SPACE}-protectors{SPACE}-get{space}c:{space}>{Space}%userprofile%\Desktop\protectors.txt") ;send code "manage-bde -protectors -get c: > %userprofile%\Desktop\protectors.txt"
Send("{ENTER}") ;send enter key to create text file on desktop with protectors
Sleep(1000) ;sleep one second(1s)


;edit txt file/create array, pull line and paste into new file, copy text then paste into cmd window below


;update data
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send("manage-bde.exe{SPACE}-protectors{SPACE}-adbackup{SPACE}c:{SPACE}-id{SPACE}{COPIEDINFORMATIONGOESHERE}")
   Send("{ENTER}")
   ;don't forget to delete temp file if you create one created.
EndIf

;remove files
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send("DEL{SPACE}%userprofile%\Desktop\protectors.txt") ;send code to delete protectors.txt
   Send("{ENTER}")
   ;don't forget to delete temp file if you create one created.
EndIf

MsgBox(0,"Done","Copy and upload are done. Please check Computer in AD.")

Func Terminate()
    Exit 0
EndFunc

 

The protectors.txt file looks like this:

BitLocker Drive Encryption: Configuration Tool version 6.1.7601
Copyright (C) Microsoft Corporation. All rights reserved.

Volume C: [OSDisk]
All Key Protectors

    TPM:
      ID: {0000000-0000-0000-0000-0000000}

    Numerical Password:
      ID: {1000000-1000-1000-1000-1000000}
      Password:
        000000-000000-000000-000000-000000-000000-000000

    Data Recovery Agent (Certificate Based):
      ID: {2000000-2000-2000-2000-2000000}
      Certificate Thumbprint:
        1111111a1aa1a1aa1a1a1a1aaaaaa1aaa1

I would specifically need the line after Numerical Password. 

Original line:      ID: {1000000-1000-1000-1000-1000000}

Needed information: -ID: {1000000-1000-1000-1000-1000000}

 

I apologize in advance for inconveniencing anyone with my silly issues. Hopefully this can stand as a great learning experience for both me and anyone else looking.

 

Share this post


Link to post
Share on other sites
JLogan3o13

@OMGWTFLOLBBQ I have moved your question to the appropriate forum, the Developers forum specifically states it is not for AutoIt-related questions. Please be mindful of where you post ;)

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
OMGWTFLOLBBQ
Just now, JLogan3o13 said:

@OMGWTFLOLBBQ I have moved your question to the appropriate forum, the Developers forum specifically states it is not for AutoIt-related questions. Please be mindful of where you post ;)

 

Apologies for the mistake, I'll be more careful in the future.

Share this post


Link to post
Share on other sites
JLogan3o13

In answer to your question: First, have you tried using just Run or ShellExecute with the appropriate switches, rather than all the Sends? Something like so?

ShellExecute("manage-bde.exe", "-protectors -get " & @DesktopDir & "\protectors.txt")

 

Second: You could read the file to an array, and parse through it that way. Something like this:

#include <File.au3>

$sFile = @DesktopDir & "\Protectors.txt"
$aFile = FileReadToArray($sFile)


For $i = 0 To UBound($aFile)
    If StringInStr($aFile[$i], "Numerical Password:") Then MsgBox($MB_OK, "", $aFile[$i + 1])
Next

One of our RegEx gurus will come along and do that more quickly, I am sure, but that should get you started :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
OMGWTFLOLBBQ
23 minutes ago, JLogan3o13 said:

In answer to your question: First, have you tried using just Run or ShellExecute with the appropriate switches, rather than all the Sends? Something like so?

ShellExecute("manage-bde.exe", "-protectors -get " & @DesktopDir & "\protectors.txt")

 

Second: You could read the file to an array, and parse through it that way. Something like this:

#include <File.au3>

$sFile = @DesktopDir & "\Protectors.txt"
$aFile = FileReadToArray($sFile)


For $i = 0 To UBound($aFile)
    If StringInStr($aFile[$i], "Numerical Password:") Then MsgBox($MB_OK, "", $aFile[$i + 1])
Next

One of our RegEx gurus will come along and do that more quickly, I am sure, but that should get you started :)

Thanks for the suggestions! Definitely got a few gears running. As for the first, I attempted ShellExecute, but it kept giving an error about "windows cannot find "manage-bde.exe". I know it's messy, but it seems to work...for now. After I get this working, I'll definitely work on streamlining it for the future.

 

Second, I've edited code based off of what you've suggested. 

$sFile = "%userprofile%\Desktop\protectors.txt"
$aFile = FileReadToArray($sFile)

For $i = 0 To UBound($aFile)
    If StringInStr($aFile[$i], "Numerical Password:") Then _ArrayToClip($MB_OK, "", $aFile[$i + 1])
Next

if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
EndIf

;update data
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send("manage-bde.exe{SPACE}-protectors{SPACE}-adbackup{SPACE}c:{SPACE}")
   Send("^v")
   Send("{ENTER}")
   ;don't forget to delete temp file if you create one created.
EndIf

I put that right in the middle, thinking I could skip the message box(which does appear to be showing the correct data), but nothing is pasting in with the Send("^V") command.... 

I appreciate the suggestions and I'll think this through for a bit tonight.

Share this post


Link to post
Share on other sites
JLogan3o13

I am guessing you don't want the entire array on the clipboard, just the one line right? Instead of _ArrayClip, do something like:

Local $sFile = "%userprofile%\Desktop\protectors.txt"
Local $aFile = FileReadToArray($sFile)
Local $sInfo

For $i = 0 To UBound($aFile)
    If StringInStr($aFile[$i], "Numerical Password:") Then $sInfo = $aFile[$i + 1]
Next

if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
EndIf

;update data
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send("manage-bde.exe{SPACE}-protectors{SPACE}-adbackup{SPACE}c:{SPACE}")
   Send($sInfo)
   Send("{ENTER}")
   ;don't forget to delete temp file if you create one created.
EndIf

 

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
mikell

This gets the needed info

$stxt = FileRead("@desktopdir & "\protectors.txt")
$sInfo = StringRegExp($stxt, 'Numerical Password:\s*(\N+)', 1)[0] 
Msgbox(0,"", $sInfo)

 

Share this post


Link to post
Share on other sites
OMGWTFLOLBBQ
18 hours ago, JLogan3o13 said:

I am guessing you don't want the entire array on the clipboard, just the one line right? Instead of _ArrayClip, do something like:

Local $sFile = "%userprofile%\Desktop\protectors.txt"
Local $aFile = FileReadToArray($sFile)
Local $sInfo

For $i = 0 To UBound($aFile)
    If StringInStr($aFile[$i], "Numerical Password:") Then $sInfo = $aFile[$i + 1]
Next

if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
EndIf

;update data
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send("manage-bde.exe{SPACE}-protectors{SPACE}-adbackup{SPACE}c:{SPACE}")
   Send($sInfo)
   Send("{ENTER}")
   ;don't forget to delete temp file if you create one created.
EndIf

 

Edited the whole bit... see below.

;BitlockerUpdate
;2016.05.25

#include <AutoItConstants.au3>
#include <Array.au3>
#include <File.au3>

;definitions
Local $pro = @DesktopDir & "\Protectors.txt" ;"%userprofile%\Desktop\protectors.txt" operating txt directory
Local $act =  WinActivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
Local $bde = "manage-bde.exe{SPACE}"
Local $arr = FileReadToArray($pro)
Local $inf

;open command and enter proper directory for use
Run("C:\Windows\System32\CMD.exe") ;open command prompt
Sleep(250) ;sleep quarter second
if ProcessExists("cmd.exe") Then
   $act ;refocus command prompt
   Send("C:" & "{ENTER}") ;send code "c:" then press enter
   Send("CD{SPACE}%windir%\sysnative\" & "{ENTER}") ;send code "CD %windir%\sysnative\" then press enter
   Send($bde & "-protectors{SPACE}-get{space}c:{space}>{Space}" & $pro & "{ENTER}") ;create protectors.txt on current desktop
  ;Sleep(250) ;sleep quarter second(.25s)
EndIf

;Needs Work
For $i = 0 To UBound($arr)
    If StringInStr($arr, "Numerical Password:") Then $inf = $arr[$i + 1]
Next

;update data
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send($bde & "-protectors{SPACE}-adbackup{SPACE}c:{SPACE}")
   Send($inf & "{ENTER}")
   ;don't forget to delete temp file if you create one created.
EndIf
;remove files
if ProcessExists("cmd.exe") Then
   winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt
   Send("DEL{SPACE}" & $pro & "{ENTER}") ;delete protectors.txt from current desktop
EndIf
;completed & confirm message box
MsgBox(0,"Done","Copy and upload are done. Please check Computer in AD.")

When I run the code, no errors appear...but nothing is pasted in after the " Send($inf  & "{Enter}") " code is applied after collecting the info from the array. Please see the attached image.

The line that should appear is: manage-bde.exe -protectors -adbackup c: -ID {1000000-1000-1000-1000-1000000} 

{1000000-1000-1000-1000-1000000}  is the variable though, it should be pulling the information from within protectors.txt from that line. 

I appreciate what you've assisted me with creating. Is it possible to get a simple definition of what you've done?

output.PNG

Share this post


Link to post
Share on other sites
JLogan3o13

Your For Loop is incorrect. Look at how I have mine written again. You need to look at $arr[$i] in your StringInStr command, not all of $arr.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
AdamUL

Here is an example script with a function that will return a PC's Numerical Password without having to automate the command prompt.  This function returns an array with the Numerical Password ID and Password.  I wrote it while working on a project to harvest BitLocker Numerical Passwords from our PCs.  You could use this function to as a template for creating a function to backup protectors to AD.  

#RequireAdmin
#include <WinAPIFiles.au3>

;Turn off redirection for a 32-bit script on 64-bit system.
If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False)

Global $vBitLockerProtectors = _BitLockerGetNumericalPassword()
If @error Then Exit MsgBox(16, "ERROR", StringReplace($vBitLockerProtectors, "  ", @CRLF))

If IsArray($vBitLockerProtectors) Then 
    MsgBox(0, "Numerical Password", "ID: " & $vBitLockerProtectors[0] & @CRLF & "Password: " & $vBitLockerProtectors[1])
EndIf


Func _BitLockerGetNumericalPassword($sComputerName = @ComputerName, $sDrive = "C:")

    Local $sManageBdeCmd = "manage-bde -protectors -get " & $sDrive & " -cn " & $sComputerName

    Local $iPIDMangeBde = Run($sManageBdeCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED)
    ProcessWaitClose($iPIDMangeBde)

    Local $sManageBdeOutput = StringStripWS(StdoutRead($iPIDMangeBde), 3)
;~  ConsoleWrite($sManageBdeOutput & @CRLF & @CRLF) ;For testing.
;~  ConsoleWrite(StringReplace($sManageBdeOutput, @CRLF, "  ") & @CRLF & @CRLF) ;For testing.

    Local $aManageBdeOutput = StringRegExp($sManageBdeOutput, "(?s)Numerical Password:.+ID:\s+{(.+)}.+Password:\s+([-0-9]+)", $STR_REGEXPARRAYGLOBALMATCH)
    If @error Then
        Local $aManageBdeOutput[2] = ["", ""]
        Local $iError = 1
        If StringInStr($sManageBdeOutput, "ERROR: No key protectors found.") Then $iError = 2 ;Fail test, PC not encrypted.
        If StringInStr($sManageBdeOutput, "ERROR: An error occurred while connecting to the BitLocker management" & @CRLF & "interface.") Then $iError = 3 ;Fail test, PC does not exist or inaccessible.
        If StringInStr($sManageBdeOutput, "ERROR: An error occurred (code 0x80070057)") Then $iError = 4 ;Fail test, drive does not exist.
        If StringInStr($sManageBdeOutput, "ERROR: An attempt to access a required resource was denied.") Then $iError = 5 ;An attempt to access a required resource was denied.
;~      Return SetError($iError, 0, $aManageBdeOutput) ;Comment the next line, and uncomment this line to get a blank array output on error.  
        Return SetError($iError, 0, StringReplace($sManageBdeOutput, @CRLF, "  ")) ;Error text returned by manage-bde.  
    EndIf
;~  _ArrayDisplay($aManageBdeOutput) ;For Testing.

    Return $aManageBdeOutput
EndFunc

If you have any questions, please let me know.  

 

Adam

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Iceburg
      By Iceburg
      Hi everyone, I'm at best a noobie.  I have read through the Array helps, and specifically the 2D array help file, and I'm struggling to get my code working.
      I have an array that is read from a file, thats working great.  I'm trying to do some math on the array, so I can find the largest, average, lowest, day over day change %, etc.
      The array read working fine, I get 43 lines, line 0 is 44, and then I get data that looks like
      0519 $10,000
      0520 $10,001
      0521 $10,002
      The data in this array is a single 1D array, breaking it out into 2 columns so I can do the math is what I can get to happen.  
      How do I reference the array to store this data?  Second, how do I assign this data to the appropriate row/column?
      Thanks in advance.
      Dim $all_cash_amounts[UBound($aInput)][2] Dim $max_amount_in_account Dim $min_amount_in_account _FileReadToArray($LC_Check_file_path, $aInput) _ArrayDisplay($aInput) local $date = StringRegExp($aInput[1], "(\d\d\d\d)", 1) local $cash = StringRegExp($aInput[1], "\d+\s(-?[0-9\.\,]+)", 1) ConsoleWrite("Date is: " & $date & @CRLF) For $i = 1 To UBound($aInput)-1     $date = StringRegExp($aInput[$i], "(\d\d\d\d)", 1)     $all_cash_amounts[$i][2] = $date[$i][0], $cash[$i][1]      Next _ArrayDisplay($all_cash_amounts)  
    • DynamicRookie
      By DynamicRookie
      Hey there!
       
      Is there a way to detect movement only for 1 specific window?

      HWnd is not really working, it still detects movement in all the windows within the region

      This is my script:
       
      ;Checksum actual HotKeySet("{f2}", 'exit_') MsgBox(0, '', '0') Beep(500, 2000) $Hwnd = WinActive('') while 1 $Checksum = PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) If PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) <> $Checksum Then For $i = 1 To 100 Beep(1000, 50) Next MsgBox(0, '', 'New message!', 1) EndIf WEnd Func exit_() Beep(500, 1000) Exit 0 EndFunc I just want to check whenever a message comes because the app i use doesn't give notifications properly.

      Any help is really appreciated!
    • OldGuyWalking
      By OldGuyWalking
      Given an array with multiple columns that is displayed in a listview,
       ===> What is the fastest/most efficient way to create and manage multiple filters and display results in ListView.
      I have a text file that loads into a listview that has string, numeric, and date columns.  The main file contains about 5100 rows. It's loaded into an array and (in this ListView) it's pre-filtered to display a range of rows based on a start and end date.  On the form I have menu options for various filters. (see below).
      I have options to filter on an "Air Date" column (=Today, >=Today, <=Today) and on a numeric field that is either 1 or 0 that indicate Active or Ended.

      For each filter option I have a prebuilt array that holds a subset of the main array based on a single filter.  For the list above I have the main Array and 5 additional arrays.  None of the arrays are updated since this is for "view only" purposes.  This is a short list and I could have done the filtering "live" but I have several of these forms and so kept the same functionality in each. I have another ListView that displays the complete 5100 row list with 3 filters that, when building the filters live was considerably slower than using prebuilt arrays.
      If I want to expand past simple single column filtering, using an array for each filter becomes cumbersome especially if I want to combine filters using AND & OR.
      The text file I'm working with has 16 columns. If I setup filters for 4 columns and include AND / OR capability that would require prebuilding 24 arrays to cover the various combinations.
      If using the slower method of building a filtered array in real time each time a different filter is selected is the only way to go with this then I'll live with it. It is less overhead. .
      Below is the code I'm currently using to "filter" an array.  My next change was going to add AND / OR functionality (see the info above the header for where I was going with this) .
      ; Description ...: Delete rows from an array and only keep rows that meet the crtieria of identified columns. ; ; Next Change: Add AND/OR to combine filters. Use array to hold multiple criteria and values? ; ; Local $aCriteria[][] = [["",$iColNbr1, $sOperator1, $vValue1], ["AND",$iColNbr2, $sOperator2, $vValue2], ["OR",$iColNbr3, $sOperator3, $vValue3]] ; The first set of criteria ["", $iColNbr1, $sOperator1, $vValue1] must start with a "". ; If anything is entered in that first parameter it will be ignored. ; If the first parameter in any additional criteria set is left blank, or it is not OR, it will default to AND. ; If $aArray is 1 dimension with more than one set of criteria, only the first set will be used. ; Any criteria that uses a column that is less than 0 or higher than the total number of columns in the array will return an error. ; ; Recognized data types for this function are: S (String), D (Date), N (Number). ; ; Recognized Operators are: "EQ", "NEQ", "IN", "GT", "GE", "LT", "LE", "BETWEEN". ; ****** Not all operators work with all data types. ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayFilter ; Description ...: Delete rows from an array and only keep rows that meet the crtieria of identified columns. ; Syntax ........: _ArrayFilter(Byref $aArray[, $iCol = 0[, $sOperator = "EQ"[, $vValue = ""[, $iOptionBase = 0]]]]) ; Parameters ....: $aArray - Array being filtered. ; $iCol - [optional] Column to filter. Default is 0. ; $sOperator - [optional] Operator. Default is "EQ". ; $vValue - [optional] Criteria to compare the column/row value against. ; $iOptionBase - [optional] Starting row. Default is 0. ; Return values .: None ; Author ........: OldGuyWalking ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ArrayFilter(ByRef $aArray, $iCol = 0, $sOperator = "EQ", $vValue = "", $iOptionBase = 0) Local $hFunc = _ArrayFilter $vValue = StringStripWS($vValue, 3) If $vValue = "[Today]" Then $vValue = _NowCalcDate() EndIf Local $sMsg Local $sMsgHdr Local $n1 Local $sDeleteIndex Local $aDeleteIndex Local $iCnt = 0 Local $iRows Local $iColMax Local $iDim Local $sData Local $sVType Local $sDType Local $LBound Local $iDiff If $iOptionBase <> 0 Then $iOptionBase = 1 EndIf If _IsValueEmpty($aArray) Then Return SetError(1, 0, "") EndIf $iDim = UBound($aArray, $UBOUND_DIMENSIONS) If $iDim = 1 Then If $iCol <> 0 Then $iCol = 0 EndIf EndIf If $iDim = 2 Then $iColMax = UBound($aArray, $UBOUND_COLUMNS) - 1 If $iCol > $iColMax Or $iCol < 0 Then Return SetError(1, 0, "") EndIf EndIf If Not _IsBetween($iDim, 1, 2) Then ;############### MSG2 - START ############### $sMsgHdr = FuncName($hFunc) & " :Line: " & @ScriptLineNumber & " :Error= " & @error $sMsg = "Invalid Dimensioned Array. Must be a 1 or 2 dimensional array." MsgBox(0, $sMsgHdr, $sMsg) Return SetError(1, 0, "") ;############### MSG2 - END ############### EndIf ; Identify what the value is ; If it is not a String, Int, Number, or Date then skip. Select Case _DateIsValid($vValue) = 1 $sVType = "D" Case IsNumber($vValue) = 1 $sVType = "N" Case IsString($vValue) = 1 $sVType = "S" Case Else ;############### MSG2 - START ############### $sMsgHdr = FuncName($hFunc) & " :Line: " & @ScriptLineNumber & " :Error= " & @error $sMsg = "Comparison value must be a " & @CRLF & _ "1. Date in YYYY/MM/DD format " & @CRLF & _ "2. A string " & @CRLF & _ "3. A number " & @CRLF MsgBox(0, $sMsgHdr, $sMsg) Return SetError(1, 0, "") ;############### MSG2 - END ############### EndSelect $iCnt = 0 For $n1 = UBound($aArray) - 1 To $iOptionBase Step -1 If $iDim = 1 Then $sData = StringStripWS($aArray[$n1], 3) ElseIf $iDim = 2 Then $sData = StringStripWS($aArray[$n1][$iCol], 3) EndIf Select Case _DateIsValid($sData) = 1 $sDType = "D" Case IsNumber($sData) = 1 $sDType = "N" Case IsString($sData) = 1 $sDType = "S" Case Else $sDType = "U" EndSelect If _IsValueEmpty($sData) Then $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop ; $sDType = $sVType EndIf If Not _IsValueEmpty($sData) And $sDType <> $sVType Then $sDeleteIndex = $sDeleteIndex & $n1 & "," $iCnt += 1 ContinueLoop EndIf Select Case $sOperator = "EQ" Switch $sDType Case "D" $iDiff = _DateDiff("D", $vValue, $sData) If $iDiff = 0 Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "S" If $sData = $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "N" If $sData = $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop EndSwitch Case $sOperator = "NEQ" Switch $sDType Case "D" If $sData <> $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "S" If $sData <> $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "N" If $sData <> $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop EndSwitch Case $sOperator = "IN" Switch $sDType Case "S" If StringInStr($sData, $vValue) Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop EndSwitch Case $sOperator = "GT" Switch $sDType Case "N" If $sData > $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "D" $iDiff = _DateDiff("D", $vValue, $sData) If $iDiff > 0 Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop EndSwitch Case $sOperator = "GE" Switch $sDType Case "N" If $sData >= $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "D" $iDiff = _DateDiff("D", $vValue, $sData) If $iDiff >= 0 Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop EndSwitch Case $sOperator = "LT" Switch $sDType Case "N" If $sData < $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "D" $iDiff = _DateDiff("D", $vValue, $sData) If $iDiff < 0 Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop EndSwitch Case $sOperator = "LE" Switch $sDType Case "N" If $sData <= $vValue Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop Case "D" $iDiff = _DateDiff("D", $vValue, $sData) If $iDiff <= 0 Then ContinueLoop EndIf $sDeleteIndex &= $n1 & "," $iCnt += 1 ContinueLoop EndSwitch EndSelect Next If $iCnt > 0 Then _DeleteArrayRows($aArray, $sDeleteIndex) EndIf EndFunc ;==>_ArrayFilter Thanks in advance.
      OldGuyWalking
    • PramodR
      By PramodR
      Can you please see whats wrong im doing in the below code? i can read few registry entry but not all for eg, i am able to get value of "Shell" Key from the registry path  but not AutoAdminLogon which has the value of "1", is there any change i have to do to read numeric values?
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","Shell" )
       ConsoleWrite("This is Hello"& $shello)
      above command returns proper value , but same command with AutoAdminLogon returns null as shown in below ? infact registry has the value of 1.
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon" )
       ConsoleWrite("This is Hello"& $shello)
    • Eminence
      By Eminence
      Hello,
      I've been searching on how to select the first row in my database which includes a time column based on the latest start_time date for today's date.
      This is my current code:
      Local $iCurrentDate = _Now() Local $sqlHandle = _dbOpen($sDbPath) Local $aResult, $iRows, $iCols _SQLite_GetTable2d($sqlHandle, "SELECT start_time FROM " & $srawDb & " ORDER BY datetime(start_time) DESC LIMIT 1", $aResult, $iRows, $iCols) _ArrayDisplay($aResult) _dbClose($sDbpath) What it does is it gets the first row entry in the database however it does not select the latest start_time entry in the database, it always select the first row. I've tried changing DESC to ASC to see if that will do it but the issue still remains. Any thoughts on this? Thanks in advance.
       
      *EDIT
      The date format in the database is by MM/DD/YYYY HH:MM:SS.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.