Jump to content
koenp

Extracting content for a text file

Recommended Posts

koenp

Hello everybody,

I am currently working on a script where the goal is to  extract certain content out of a txt will and put this in a other file

EXAMPLE OF TXT FILE

CHU LIEGE                                                                               SART TILMAN - LIEGE
Name: ABC CDE                   Patient ID: 20120831
Sample ID: 200604003705              Sample Type:Serum                      Dilution Factor: 1
Priority: Routine                    Rack Position: QK000137-6              Completed On: 2013-06-05 15:35:54
Operator: C135669REGI                Instrument ID: DV330681                Aliquot Creation Time: 2013-06-05 14:40:37
Comment:
   Method           Result   Units   RefRange        Flag                Comment                          Reagent
   IGG3             0.389    g/L     0.11 - 0.85                                                          12292MA
   IGG4                              0.03 - 2.01     Below Assay Range                                    12324MA
   IGG2                              1.69 - 7.86     Below Assay Range                                    12310MA
   IGG4             0.009    g/L     0.03 - 2.01                         Diluted                          12324MA
                                                                         Below Reference
                                                                         Range
   IGG2             0.368    g/L     1.69 - 7.86                         Diluted                          12310MA
                                                                         Below Reference
                                                                         Range
NON-STANDARD CONFIGURATION                                                                   Printed 2013-06-05 15:35:57

I am only interested starting from line 9 (IGG3...)

My goal is to have following structure:
IGG3;0.389;g/L;0.11-.085;;;12292MA
IGG4;;;0.03-2.01;Below Assay Range;;12324MA
IGG2;;;1.69-7.86:Below Assasy Range;;12310MA
IGG4;.009;g/L;0.03-2.01;;Diluted;12324MA

Here is the code that I currently have created:

Global $SampleID = StringRegExp(FileRead($file), "Sample ID:" & '\s+(\S+)', 3)
Global $instr = StringRegExp(FileRead($file), "Instrument ID:" & '\s+(\S+)', 3)
Global $type = StringRegExp(FileRead($file), "Type:" & '\S+', 3)


Global $end = StringRegExp(FileRead($file), "Reagent" & '\s+(\S+)', 3)
Global $result1 = StringRegExp(FileRead($file), $end[0] & '\s+(\S+)', 3)
Global $unit1 = StringRegExp(FileRead($file), $result1[0] & '\s+(\S+)', 3)
Global $normals1a = StringRegExp(FileRead($file), $unit1[0] & '\n+', 3)
Global $normals1b = StringRegExp(FileRead($file), $normals1a[0] & '\s+(\S+)', 3)
Global $normals1c = StringRegExp(FileRead($file), $normals1b[0] & '\s+(\S+)', 3)

Local $hFileOpen = FileOpen($patientresult, $FO_APPEND)
    FileWriteLine($hFileOpen, $date & " ; " & $SampleID[0] & " ; " & $instr[0] & " ; " & $type[0] & " ; " & $end[0] & " ; " & $result1[0] & " ; " & $unit1[0] & $normals1a[0] & " ; " & $normals1b[0] & " ; " & @CRLF)
 FileClose($hFileOpen)

 

Can anybody help me with this or give me some advice how to complete this task?

 

Many thanks in advanced and for having a look in to it

 

 

 

Share this post


Link to post
Share on other sites
Melba23

koenp,

My effort:

$sText = "CHU LIEGE                                                                               SART TILMAN - LIEGE" & @CRLF & _
        "Name: ABC CDE                   Patient ID: 20120831" & @CRLF & _
        "Sample ID: 200604003705              Sample Type:Serum                      Dilution Factor: 1" & @CRLF & _
        "Priority: Routine                    Rack Position: QK000137-6              Completed On: 2013-06-05 15:35:54" & @CRLF & _
        "Operator: C135669REGI                Instrument ID: DV330681                Aliquot Creation Time: 2013-06-05 14:40:37" & @CRLF & _
        "Comment:" & @CRLF & _
        "   Method           Result   Units   RefRange        Flag                Comment                          Reagent" & @CRLF & _
        "   IGG3             0.389    g/L     0.11 - 0.85                                                          12292MA" & @CRLF & _
        "   IGG4                              0.03 - 2.01     Below Assay Range                                    12324MA" & @CRLF & _
        "   IGG2                              1.69 - 7.86     Below Assay Range                                    12310MA" & @CRLF & _
        "   IGG4             0.009    g/L     0.03 - 2.01                         Diluted                          12324MA" & @CRLF & _
        "                                                                        Below Reference" & @CRLF & _
        "                                                                        Range" & @CRLF & _
        "   IGG2             0.368    g/L     1.69 - 7.86                         Diluted                          12310MA" & @CRLF & _
        "                                                                        Below Reference" & @CRLF & _
        "                                                                        Range" & @CRLF & _
        "NON-STANDARD CONFIGURATION                                                                   Printed 2013-06-05 15:35:57"

$aRet = StringRegExp($sText, "(IGG\d|\d\.\d{3}|\d.\d\d\s-\s\d\.\d\d|\d{5}MA)", 3)

$sRet = ""
For $i = 0 To UBound($aRet) - 1
    If StringInStr($aRet[$i], "IGG") Then
        $sRet &= $aRet[$i] & ";"
        $i += 1
        If Stringinstr($aRet[$i], "-") Then
            $sRet &= ";;" & $aRet[$i] & ";Below Assay Range;;"
            $i += 1
        Else
            $sRet &= $aRet[$i] & ";g/L;" & $aRet[$i + 1] & ";;;"
            $i += 2
        EndIf
        $sRet &= $aRet[$i] & @CRLF
    EndIf
Next

ConsoleWrite($sRet & @CRLF)

Now wait for real RegEx guru to do it in one line!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
koenp

Thanks a lot Melba23,

this looks very close to what I am looking for, just maybe some small adaptations:

The IGG (testcode)  is variable can be anything the same for the g/L (unit).

Is this possible to adapt?

for the rest this looks exactly what I am looking for

 

Many thanks for your effort !!

Koen

 

Share this post


Link to post
Share on other sites
Melba23

koenp,

Quote

The IGG (testcode)  is variable can be anything the same for the g/L (unit).

Once again we find that example in the original question does not actually reflect the real world case - and so once again we waste time coming up with a solution which does not fit the actual requirement. Point taken?

A different approach is needed if there is no obvious pattern to some of the elements - perhaps this:

#include <Array.au3>
#include <StringConstants.au3>

$sText = "CHU LIEGE                                                                               SART TILMAN - LIEGE" & @CRLF & _
        "Name: ABC CDE                   Patient ID: 20120831" & @CRLF & _
        "Sample ID: 200604003705              Sample Type:Serum                      Dilution Factor: 1" & @CRLF & _
        "Priority: Routine                    Rack Position: QK000137-6              Completed On: 2013-06-05 15:35:54" & @CRLF & _
        "Operator: C135669REGI                Instrument ID: DV330681                Aliquot Creation Time: 2013-06-05 14:40:37" & @CRLF & _
        "Comment:" & @CRLF & _
        "   Method           Result   Units   RefRange        Flag                Comment                          Reagent" & @CRLF & _
        "   IGG3             0.389    g/L     0.11 - 0.85                                                          12292MA" & @CRLF & _
        "   Random                            0.03 - 2.01     Below Assay Range                                    12324MA" & @CRLF & _
        "   IGG2                              1.69 - 7.86     Below Assay Range                                    12310MA" & @CRLF & _
        "   ABC4             0.009    random  0.03 - 2.01                         Diluted                          12324MA" & @CRLF & _
        "                                                                        Below Reference" & @CRLF & _
        "                                                                        Range" & @CRLF & _
        "   IGG2             0.368    g/L     1.69 - 7.86                         Diluted                          12310MA" & @CRLF & _
        "                                                                        Below Reference" & @CRLF & _
        "                                                                        Range" & @CRLF & _
        "NON-STANDARD CONFIGURATION                                                                   Printed 2013-06-05 15:35:57"

; Simulate reading file into an array
$aLines = StringSplit($stext, @CRLF, $STR_ENTIRESPLIT)
; Find "Method" line
$iStart = _ArraySearch($aLines, "Method", 0, 0, 0, 1) + 1
; Find "NON-STANDARD" line
$iEnd = _ArraySearch($aLines, "NON-STANDARD", 0, 0, 0, 1) - 1
; Construct return
$sRet = ""
For $i = $iStart To $iEnd
    ; Replace spaces in line with "|"
    $sLine = StringRegExpReplace($aLines[$i], "\s+", "|")
    ; Count instances
    StringReplace($sLine, "|", "")
    ; Valid line if at least 3
    If @extended > 2 Then
        $aSplit = StringSplit($sLine, "|")
        ; See which form line takes and contruct accordingly
        If $aSplit[6] = "-" Then
            $sRet &= $aSplit[2] & ";" & $aSplit[3] & ";" & $aSplit[4] & ";" & $aSplit[5] & "-" & $aSplit[7] & ";;;" & $aSplit[$aSplit[0]] & @CRLF
        Else
            $sRet &= $aSplit[2] & ";;;" & $aSplit[3] & "-" & $aSplit[5] & ";Below Assay Range;;" & $aSplit[$aSplit[0]] & @CRLF
        EndIf
    EndIf
Next

ConsoleWrite($sRet & @CRLF)

That works on my self-modified data - does it on the real world case? If not then please post some representative data.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mikell

I highly suspect a tab delimitation in this txt file. In this case it would obviously make brain-storming less painful  :)
Could you post the real file ? 

Edit
Without more infos, and empirically assuming that *4 or more spaces* will work as delimiter, here are my 2 cents
[btw Melba, your code skips the "diluted" :) ]

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

$sText = "CHU LIEGE                                                                               SART TILMAN - LIEGE" & @CRLF & _
        "Name: ABC CDE                   Patient ID: 20120831" & @CRLF & _
        "Sample ID: 200604003705              Sample Type:Serum                      Dilution Factor: 1" & @CRLF & _
        "Priority: Routine                    Rack Position: QK000137-6              Completed On: 2013-06-05 15:35:54" & @CRLF & _
        "Operator: C135669REGI                Instrument ID: DV330681                Aliquot Creation Time: 2013-06-05 14:40:37" & @CRLF & _
        "Comment:" & @CRLF & _
        "   Method           Result   Units   RefRange        Flag                Comment                          Reagent" & @CRLF & _
        "   IGG3             0.389    g/L     0.11 - 0.85                                                          12292MA" & @CRLF & _
        "   Random                            0.03 - 2.01     Below Assay Range                                    12324MA" & @CRLF & _
        "   IGG2                              1.69 - 7.86     Below Assay Range                                    12310MA" & @CRLF & _
        "   ABC4             0.009     random     0.03 - 2.01                         Diluted                          12324MA" & @CRLF & _
        "                                                                        Below Reference" & @CRLF & _
        "                                                                        Range" & @CRLF & _
        "   IGG2             0.368    g/L     1.69 - 7.86                         Diluted                          12310MA" & @CRLF & _
        "                                                                        Below Reference" & @CRLF & _
        "                                                                        Range" & @CRLF & _
        "NON-STANDARD CONFIGURATION                                                                   Printed 2013-06-05 15:35:57"


; $sText = FileRead ... etc
$sText = StringRegExpReplace($sText, '(?s).*Reagent\s*(.*?)NON-STANDARD.*', "$1")
;Msgbox(0,"", $sText)
$res = StringRegExp($sText, '(?m)^(?!\s+Below|\s+Range)\s*(\N+)\R?', 3)
;_ArrayDisplay($res)

For $i = 0 to UBound($res)-1
   $tmp = StringRegExp($res[$i], '\s*(.*?\S)(?=\s{4,}|$)', 3)
;_ArrayDisplay($tmp)
   If $tmp[2] = "Below Assay Range" Then 
          $res[$i] = $tmp[0] & ";;;" & $tmp[1] & ";Below Assay Range;;" & $tmp[3]
   ElseIf $tmp[4] = "Diluted" Then 
          $res[$i] = $tmp[0] & ";" & $tmp[1] & ";" & $tmp[2] & ";" & $tmp[3] & ";;Diluted;" & $tmp[5]
   Else
          $res[$i] = $tmp[0] & ";" & $tmp[1] & ";" & $tmp[2] & ";" & $tmp[3] & ";;;" & $tmp[4]
   EndIf
Next

FileDelete("output.txt")
_FileWriteFromArray("output.txt", $res) 

; verification
Sleep(100)
Local $aOutput
_FileReadToArray("output.txt", $aOutput, 0, ";")
_ArrayDisplay($aOutput)

 

Edited by mikell
  • Like 1

Share this post


Link to post
Share on other sites
koenp

Hi,

Many thanks for helping me out.

I have attached 2 example files.

Just to make it clear/easier:

I only need Method; Result; Units ;;;Reagent

RefRange and Flags and comments can be ignored

Many thanks,
Koen

 

pat_layout_1.txt

pat_layout_2.txt

Share this post


Link to post
Share on other sites
Melba23

koenp,

No tabs, so what I posted above works nicely on the real files:

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

$aList = _FileListToArray(@ScriptDir, "pat_layout*.txt", 1)

For $i = 1 To $aList[0]

    $sRet = _ParseFile($aList[$i])
    ConsoleWrite($sRet & @CRLF)

Next

Func _ParseFile($sFile)

    ; Read file into an array
    Local $aLines
    _FileReadToArray($sFile, $aLines)
    ; Find "Method" line
    $iStart = _ArraySearch($aLines, "Method", 0, 0, 0, 1) + 1
    ; Find "NON-STANDARD" line
    $iEnd = _ArraySearch($aLines, "NON-STANDARD", 0, 0, 0, 1) - 1
    ; Construct return
    $sExtract = ""
    For $i = $iStart To $iEnd
        ; Replace spaces in line with "|"
        $sLine = StringRegExpReplace($aLines[$i], "\s+", "|")
        ; Count instances
        StringReplace($sLine, "|", "")
        ; Valid line if at least 3
        If @extended > 2 Then
            $aSplit = StringSplit($sLine, "|")
            ; See which form line takes and contruct accordingly
            If $aSplit[6] = "-" Then
                $sExtract &= $aSplit[2] & ";" & $aSplit[3] & ";" & $aSplit[4] & ";" & $aSplit[5] & "-" & $aSplit[7] & ";;;" & $aSplit[$aSplit[0]] & @CRLF
            Else
                $sExtract &= $aSplit[2] & ";;;" & $aSplit[3] & "-" & $aSplit[5] & ";Below Assay Range;;" & $aSplit[$aSplit[0]] & @CRLF
            EndIf
        EndIf
    Next

    Return $sExtract

EndFunc   ;==>_ParseFile

Results:

RF;431;IU/mL;0.0-15.0;;;13049MA

IGG3;0.389;g/L;0.11-0.85;;;12292MA
IGG4;;;0.03-2.01;Below Assay Range;;12324MA
IGG2;;;1.69-7.86;Below Assay Range;;12310MA
IGG4;0.009;g/L;0.03-2.01;;;12324MA
IGG2;0.368;g/L;1.69-7.86;;;12310MA

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
koenp

Thanska a lot @Melba23

 I tested it as well and indeed works fine..

Once the rest of the coding is done I will publish it here so that you  can see the result

@mikell, I like the way you displayed the tables, but is there a easy way to close it popup automaticly like you can do with msgbox ?

 

Many thanks for all your help !!

Koen

Share this post


Link to post
Share on other sites
Melba23

koenp,

Glad I could help.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mikell

koenp,
_ArrayDisplay is a debug function with no timeout, I used it only for checking
To get a similar display you need to build a gui and a listview

Share this post


Link to post
Share on other sites
Melba23

koenp,

If you give your _ArrayDisplay dialog a suitably unique title then you can easily close it programmatically:

#include <MsgBoxConstants.au3>
#include <Array.au3>

$sTitle = "Unique Title"

Global $aArray[][] = [[0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]

; Run a function every 5 secs
AdlibRegister("_Close_Array_Dialog", 5000)

; Open the dialog
_ArrayDisplay($aArray, $sTitle, Default, 8)

MsgBox($MB_SYSTEMMODAL, "Hi", "The array dialog has closed", 2)

Func _Close_Array_Dialog()

    ; Cancel future calls
    AdlibUnRegister("_Close_Array_Dialog")
    ; Close the dialog
    WinClose($sTitle)

EndFunc

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mikell

Nice workaround  :)

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

    • ufukreis1212
      By ufukreis1212
      Hello, I am new members. Help me please. I want vbs convert to au3 .
      This vbs code : 
      'deneme Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem") strOSArch = GetObject("winmgmts:root\cimv2:Win32_OperatingSystem=@").OSArchitecture Set objNetwork = CreateObject("Wscript.Network") Set wshShell = CreateObject( "WScript.Shell" ) strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) Set oShell = WScript.CreateObject("WScript.Shell") proc_arch = oShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%") Set oEnv = oShell.Environment("SYSTEM") strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colMB = objWMIService.ExecQuery("Select * from Win32_BaseBoard") Set colCSes = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colProcessors = objWMIService.ExecQuery("Select * from Win32_Processor") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItemsx = objWMIService.ExecQuery( _ "SELECT * FROM Win32_VideoController",,48) '------------------------------------------------------------------- Set obj = GetObject("winmgmts:").InstancesOf("Win32_PhysicalMemory") i = 1 For Each obj2 In obj memTmp1 = obj2.capacity / 1024 / 1024 TotalRam = TotalRam + memTmp1 i = i +1 Next '-------------------------------------------------------------------- Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set colItems = objWMIService.ExecQuery("Select Architecture from Win32_Processor") For Each objItem in colItems if objItem.Architecture = 0 then strArchitecture = "x86" end if if objItem.Architecture = 9 then strArchitecture = "x64" end if next '-------------------------------------------------------------------- strComputer = "." ' Local computer strMemory = "" i = 1 set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory") For Each objItem In colItems if strMemory <> "" then strMemory = strMemory & vbcrlf strMemory = strMemory & "Bank" & i & " : " & (objItem.Capacity /1024 /1024) & " Mb" i = i + 1 Next installedModules = i - 1 Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray") For Each objItem in colItems totalSlots = objItem.MemoryDevices Next '---------------------------------------------------------------------- Set objWMISvc = GetObject( "winmgmts:\\.\root\cimv2" ) Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem" ) For Each objItem in colItems strComputerDomain = objItem.Domain Next for each System in SystemSet For Each objItem in colItemsx For Each objProcessor in colProcessors For Each bbType In colMB MbVendor = bbType.Manufacturer MbModel = bbType.Product MsgBox "İşletim Sistemi : " & System.Caption & vbNewLine & _ "İşletim Sistemi Versionu : " & + System.Version & vbNewLine & _ "Windows Mimari Yapısı: " & strOSArch & vbNewLine & _ "Kullanıcı isminiz: " & objNetwork.UserName & vbNewLine & _ "Bilgisayar ismi: " & strComputerName & vbNewLine & _ "Çalışma Grubu: " & strComputerDomain & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Anakart: " & MbVendor & " " & "[" & MbModel & "]" & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Grafik Kartı: " & objItem.Caption & vbNewLine & _ "Driver Version: " & objItem.DriverVersion & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "İşlemci Üreticisi: " & objProcessor.Manufacturer & vbNewLine & _ "İşlemci İsmi: " & objProcessor.Name & vbNewLine & _ "CPU Mimarisi: " & strArchitecture & vbNewLine & _ "İşlemci Çekirdek sayısı: " & oEnv("NUMBER_OF_PROCESSORS") & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Toplam RAM: " & TotalRam & " MB" & vbNewLine & _ "Toplam Slot: " & totalSlots & vbNewLine & _ "Boş Slot: " & (totalSlots - installedModules) & vbNewLine & _ "Ramlerin bulunduğu slotlar:" & vbcrlf & strMemory,0,"deneme" Next Next Next Next please help me , thanks.
    • JuanFelipe
      By JuanFelipe
       
      Hello friends, I have a query, it happens that I have a matrix nxn, the first column of this contains each cell a number with 21 digits, when I pass this matrix to Excel I obviously write that number as 1,10016E + 20, I solved it by adding a * at the end of each cell, but I want it to be written as a text so that I do not have to remove that *, I searched in Google but could not find an effective solution, thanks in advance. 
    • Puls3
      By Puls3
      Hi, This is my first post on the AutoIt Forums, I most of the time was able to get help from this community by merely searching though google and have been able to solve hundreds of problems this way, though in this case I was incapable of finding a solution to my problem. I am quite confident that it is a user error (And my fault) but I haven't been able to determine what I did wrong, any and all help would be greatly appreciated! I have uploaded my whole script pardon passwords to provide as much information as possible.
      I declared a global array at the top of the script and am having issues when I try to set it's value, and I fail to understand why.
      Error Message:
      "D:\Projects\AutoIt\Arena\Base.au3" (270) : ==> Subscript used on non-accessible variable.:
      $ExpMax[$i] = IniRead($TempSavePath, "Combatant" & $i, "ExpMax", $ExpMax[0])
      $ExpMax^ ERROR
      ConsoleWrite Log:
      Ran.
      Checking launch parameters.
      No launch parameters.
      Initiating load.
      Checking for save file.
      Save file not found.
      Load canceled.
      Loading or creating Combatant 1
      Base.au3
    • RamDemon
      By RamDemon
      Hi,
      Did anyone tried to  use Redis  with AutoIT as store DB ?
       Redis <-- more about it
      Mladen
    • nooneclose
      By nooneclose
      Hey. I'm working on a new project and was wondering if there is a better way to "update" my Column E array. 
      Here is my code: 
      Local $nI  = 0                                                            ;Creates a name index of 0: nI = Name index Local $nII = 1                                                            ;Creates a name index of 1 for second loop: nII = Name Index 2 For    $iN = 0 To $IndexRows Step 1                                       ;Checks the roster for any names that appear twice      For $iN2 = 0 To $IndexRows Step 1          if $d_Names[$nI] == $d_Names[$nII] And $d_Names[$nII] <> "" Then              Local $timeSheetName = _ArraySearch($e_Names, $d_Names[$nI], 0, 0, 0, 0, 1)              ;MsgBox($MB_SYSTEMMODAL, "Found it", $d_Names[$nI] & " In column E on Row " & $timeSheetName)              Local $eI  = $timeSheetName + 1              ;ConsoleWrite($timeSheetName & @CRLF)              ;ConsoleWrite($eI & @CRLF)              ;ConsoleWrite(@CRLF)              _Excel_RangeInsert($OpenWorkbook.ActiveSheet, "E" & $eI & ":F" & $eI, $xlShiftDown)                                                                          ;Inserts a empty cell in columns E and F.              _Excel_RangeWrite($OpenWorkbook, $OpenWorkbook.ActiveSheet, $d_Names[$nII], "E" & $eI)                                                                         ;Fills the empty cell in columns E with the doubled name              $aArray_Index = 2                                           ;Array element counter              For $Index = 2 To $IndexRows Step 1                        ;Loops through every row in the Excel file unto no rows are found or a null row is found                  $Array_Value_E = _Excel_RangeRead($OpenWorkbook, Default, "E"&$Index)                  $e_names[$aArray_Index] = $Array_Value_E                ;While the code loops every value in column E is stored in the E array (updating the array)                  $aArray_Index += 1              Next              ExitLoop          EndIf      Next      $nI  += 1      $nII += 1 Next Basically, It checks a roster for people whose name appears twice then inserts a new "row" for that person because they work in two different departments.
      I have to find that name however in Column E if two appear in column D. My code works but I think it is not as efficient as it could be. 
      Any ideas on how to improve the "update" for my array?
      (once it finds the double names in Column D it then searches for that name by going name by name in the Column E array and once it finds it inserts a new row. However, the E array doesn't have that new row stored in it so I have to "update" the array to properly find the next name)
      Any and all tips would be greatly appreciated. 
       
      NOTE: Just assume I'm opening the excel file properly please do not add that code in, it only complicates your answer. 
×