chacoya121

plz help how to organize from notepad or Ini file

7 posts in this topic

#1 ·  Posted (edited)

plz help how to organize information from notepad or INIfile

Example:

0=000308
1=000308
2=000308
3=000308
4=000408
5=000408
6=000408
7=000408
8=000408
9=000408
10=000308
11=000308
12=000308
13=000408
14=000408
15=000408
16=000408
17=000408
18=000408
19=000408
20=000308
21=000308
22=000308
23=000408
24=000408
25=000408
26=000408
27=000408
28=000408
29=000408
30=000308

 0=000308 x 11 total

 1=000408 x 20 total

2 lines summary all

 

Thank you

 

Edited by chacoya121

Share this post


Link to post
Share on other sites



#2 ·  Posted

What do you mean by organize? Do you want to create an Ini File in sections like, or do you want to just read the data into an Array?

[000308]
01=000308
02=000308
...
[000408]
01=000408
02=000408
...

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

read data and organize and count total of each result

0=000308
1=000308
2=000308
3=000308
4=000408
5=000408
6=000408
7=000408
8=000408
9=000408
10=000308
11=000308
12=000308
13=000408
14=000408
15=000408
16=000408
17=000408
18=000408
19=000408
20=000308
21=000308
22=000308
23=000408
24=000408
25=000408
26=000408
27=000408
28=000408
29=000408
30=000308

total = 11x 000308
total = 20x 000408

 

Edited by chacoya121

Share this post


Link to post
Share on other sites

#4 ·  Posted

You can try something like:

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

Local $aArray, $a000308[1][2], $a000408[1][2]
_FileReadToArray("Dummy01.txt", $aArray, $FRTA_COUNT, "=")
For $i = 1 To $aArray[0][0]
    If $aArray[$i][1] = "000308" Then
        _ArrayAdd($a000308, $aArray[$i][0] & "|" & $aArray[$i][1])
    Else
        _ArrayAdd($a000408, $aArray[$i][0] & "|" & $aArray[$i][1])
    EndIf
Next
$a000308[0][0] = UBound($a000308) - 1
$a000408[0][0] = UBound($a000408) - 1
_ArrayDisplay($a000308)
_ArrayDisplay($a000408)
_ArrayDisplay($aArray)

 

Share this post


Link to post
Share on other sites

#5 ·  Posted

what if u have a scramble of files need to organize

cuz this just only 2 files 

what if u have large number of files

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

another way,

#include <Array.au3>

Local $sum[1][2], $find, $index, $count = 0, $source = IniReadSection("new.ini", "section")

Local $tmp = _Array_FromColumn($source, 1)

Local $ini = _ArrayUnique($tmp, Default, Default, 1, 0)

For $i = UBound($ini) - 1 To 1 Step -1
    $find = $ini[$i]
    $index = UBound($source) - 1
    Do
        $index = _ArraySearch($source, $find, 0, $index - 1, 1, 0, 0, 1)
        If Not @error Then
            $count += 1
        EndIf
    Until @error Or $index <= 1
    _ArrayAdd($sum, $find & "," & " x " & $count, 0, ",")
    $sum[0][0] += 1
    $count = 0
Next

_ArrayDisplay($sum)

Func _Array_FromColumn(ByRef $aArray, $iColumn = 0, $istart = 1)
    Local $aArray1D = ['']
    For $i = $istart To UBound($aArray) - 1
        _ArrayAdd($aArray1D, $aArray[$i][$iColumn])
    Next
    Return $aArray1D
EndFunc   ;==>_Array_FromColumn

 

Edited by Deye

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

HotKeySet("{Home}", "Start")
HotKeySet("{Esc}", "MyExit")

Global $colorcount = 0

While 1
    Sleep(100)
WEnd

Func MyExit()
    Exit
EndFunc

Func Start()
    For $i = 0 to 9 Step +1
        For $j = 0 to 9 Step +1
            $color = PixelGetColor($i,$j)
            IniWrite("Color Code.ini","Color",$colorcount,Hex($color,6))
            $colorcount += 1
        Next
    Next
EndFunc

can someone help me organize this color count, i m just curious how it work, cuz i try to figure out how it work but soo confusing me, im low lvl programing and sorry for my english

Edited by chacoya121

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

    • Skeletor
      By Skeletor
      Hi Guys,
      When I used to scratch the surface with Delphi5, I could only create a simple Notepad program.
      Now that I'm into AutoIt, I've created just a bare bone Notepad.
      Can be improved, but maybe this will be useful for those, like me, starting out with programming.
      I know there are way better notepads out there like Aupad, but,
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <APIDlgConstants.au3> #include <Memory.au3> #include <WinAPIDlg.au3> #include <WinAPIFiles.au3> Opt('WinTitleMatchMode', 3) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Notepad", 620, 440, 192, 124) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem4 = GUICtrlCreateMenuItem("New" & @TAB & "Ctrl+N", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("Open" & @TAB & "Ctrl+O", $MenuItem1) $MenuItem6 = GUICtrlCreateMenuItem("Save" & @TAB & "Ctrl+S", $MenuItem1) $MenuItem17 = GUICtrlCreateMenuItem("Print" & @TAB & "Ctrl+P", $MenuItem1) $MenuItem7 = GUICtrlCreateMenuItem("Exit" & @TAB & "Ctrl+W", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo" & @TAB & "Ctrl+Z", $MenuItem2) $MenuItem9 = GUICtrlCreateMenuItem("Cut" & @TAB & "Ctrl+X", $MenuItem2) $MenuItem10 = GUICtrlCreateMenuItem("Copy" & @TAB & "Ctrl+C", $MenuItem2) $MenuItem11 = GUICtrlCreateMenuItem("Paste" & @TAB & "Ctrl+V", $MenuItem2) $MenuItem12 = GUICtrlCreateMenuItem("Delete" & @TAB & "Del", $MenuItem2) $MenuItem16 = GUICtrlCreateMenu("Format") $MenuItem19 = GUICtrlCreateMenuItem("Word Wrap", $MenuItem16) $MenuItem18 = GUICtrlCreateMenuItem("Font", $MenuItem16) $MenuItem15 = GUICtrlCreateMenu("View") $MenuItem20 = GUICtrlCreateMenuItem("Status Bar", $MenuItem15) $MenuItem3 = GUICtrlCreateMenu("Help") $MenuItem13 = GUICtrlCreateMenuItem("View Help", $MenuItem3) $MenuItem14 = GUICtrlCreateMenuItem("About Notepad" & @TAB & "F1", $MenuItem3) $Edit1 = GUICtrlCreateEdit("", 0, 0, 620, 420, $ES_WANTRETURN) GUICtrlSetFont($Edit1, 10, 400, -1, "Lucida Console") GUICtrlSetData(-1, "") Dim $Form1_AccelTable[11][2] = [["^n", $MenuItem4], ["^o", $MenuItem5], ["^s", $MenuItem6], ["^p", $MenuItem17], ["^w", $MenuItem7], ["^z", $MenuItem8], ["^x", $MenuItem9], ["^c", $MenuItem10], ["^v", $MenuItem11], ["{DEL}", $MenuItem12], ["{F1}", $MenuItem14]] GUISetAccelerators($Form1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Warning If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(52, "Notepad Closing", "Are you sure you want to exit?") Select Case $iMsgBoxAnswer = 6 ;Yes Exit Case $iMsgBoxAnswer = 7 ;No EndSelect #EndRegion --- CodeWizard generated code Start --- Case $MenuItem4 GUICtrlSetData($Edit1, "") Case $MenuItem5 FileOpenDialog("Open Text File", @DesktopDir, "Text File (*.txt)") Case $MenuItem6 $filesave = FileSaveDialog("Save Text File", @DesktopDir, "Text File (*.txt)") $Edit1_Read = GUICtrlRead($Edit1) FileWrite($filesave, $Edit1_Read) Case $MenuItem7 #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Warning If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(52, "Notepad Closing", "Are you sure you want to exit?") Select Case $iMsgBoxAnswer = 6 ;Yes Exit Case $iMsgBoxAnswer = 7 ;No EndSelect #EndRegion --- CodeWizard generated code Start --- EndSwitch WEnd If you don't attempt something, you never know you can actually achieve that goal.
    • Wingens
      By Wingens
      Hi I am trying to read multiple sections from an ini file into an array and use the result to calculate how many records there are from the suppliers and this devided into the status records that belong to it. The problem I am having; I am able to use Ubound to calculate how many record there are in total to the option chosen from the combo box, but where I am getting stuck is the part to link the status and leverancier to each other and count them.
      Hope some one can help me.
      My code right now:
      #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <file.au3> #include <array.au3> $Form1 = GUICreate("Form1", 615, 437, 569, 253) $LEVCOMBO = GUICtrlCreateCombo("", 184, 112, 145, 25, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) Global $aSections = IniReadSectionNames(@ScriptDir & "\leveranciers.ini") If (Not @Error) Then GUICtrlSetData($LEVCOMBO, _ArraytoString($aSections, "|", 1), $aSections[1]) $LABEL = GUICtrlCreateLabel("Totaal aantal RMA aanvragen: ", 48, 200, 250, 21) $TOTALCOUNT = GUICtrlCreateLabel("", 200, 200, 100, 21) $LABEL2 = GUICtrlCreateLabel("Aantal aangevraagd: ", 48, 225, 250, 21) $TOTALAANGEVRAAGD = GUICtrlCreateLabel("", 200, 225, 100, 21) $LABEL3 = GUICtrlCreateLabel("Aantal verzonden: ", 48, 250, 250, 21) $TOTALVERZONDEN = GUICtrlCreateLabel("", 200, 250, 100, 21) $LABEL4 = GUICtrlCreateLabel("Aantal afgehandeld: ", 48, 275, 250, 21) $TOTALAFGEHANDELD = GUICtrlCreateLabel("", 200, 275, 100, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $LEVCOMBO COMBO() EndSwitch WEnd Func COMBO() Local $hINI_FILENAME = @ScriptDir & "\ini.ini" $READAANGEVRAAGDRMA = IniReadSection($hINI_FILENAME, 'LEVERANCIER') $READSTATUS = IniReadSection($hINI_FILENAME, 'STATUS') $VAR = GUICtrlRead($LEVCOMBO) $READAANGEVRAAGDRMACOUNT = _ArrayFindAll($READAANGEVRAAGDRMA, $VAR, Default, Default, Default, Default, 1) GUICtrlSetData($TOTALCOUNT,UBound($READAANGEVRAAGDRMACOUNT)) $nb = $READAANGEVRAAGDRMA[0][0] Local $res[$nb+1][3] $res[0][0] = $nb For $i = 1 to $nb $res[$i][0] = $READAANGEVRAAGDRMA[$i][1] $res[$i][1] = $READSTATUS[$i][1] Next _ArrayDisplay($res) EndFunc And the ini files that goes with it:
      ini.ini:
      [STATUS] 1=Afgehandeld 3=Verzonden 4=Aangevraagd 5=Aangevraagd 6=Aangevraagd 7=Aangevraagd 8=Verzonden 9=Aangevraagd 10=Aangevraagd 11=Aangevraagd 12=Aangevraagd 13=Aangevraagd 14=Aangevraagd 15=Aangevraagd 16=Aangevraagd 17=Aangevraagd 18=Aangevraagd 19=Aangevraagd 20=Aangevraagd 21=Aangevraagd 22=Aangevraagd [LEVERANCIER] 9=Dobit B.V. 1=Dobit B.V. 10=Dobit B.V. 11=Dobit B.V. 12=Dobit B.V. 13=Dobit B.V. 14=Asus 15=Asus 16=Brother 17=Dobit B.V. 18=Dobit B.V. 19=Dobit B.V. 20=Dobit B.V. 21=Dobit B.V. 22=Asus leveranciers.ini:
      [Kies een leverancier...] [Dobit B.V.] URL =http://eline.dobit.be/eline/master.php [TechData B.V.] URL = [MaxICT B.V.] URL = [Brother] URL= [Asus] URL=https://eu-rma.asus.com/pickup_europe/pickup.aspx?country=nl [HP] URL= [Lenovo] URL= [CCV] URL=  
      test.au3
      ini.ini
      leveranciers.ini
    • dreivilo47
      By dreivilo47
      I have a Dutch version of Windows 10.
      The Dutch word for "File" = "Bestand" and for "Page Setup" = "Pagina-instelling".
      WinMenuSelectItem doesn't select this items.  What can be the reason?
       
      Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") WinMenuSelectItem("[CLASS:Notepad]", "", "Bestand", "Pagina-instelling...") Sleep(4000) WinClose("[CLASS:Notepad]")  
    • PINTO1927
      By PINTO1927
      Hi guys,
      you can know the @namecomputer or ip address of the client who opened a notepad file?
      I created a chat through a shared notepad .. and I thought of adding an edit "who is online" ..
      here it is the code: 
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <GuiButton.au3> #include <TrayConstants.au3> #include <Color.au3> #include <ColorConstants.au3> #include <ButtonConstants.au3> #include <GUIComboBox.au3> #Include <GuiComboBoxEx.au3> #include <GuiConstantsEx.au3> #include <TreeViewConstants.au3> #include <GuiTreeView.au3> #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <GuiEdit.au3> #include <Array.au3> #include <Misc.au3> #include <ColorConstantS.au3> Local $hDLL = DllOpen("user32.dll") FileInstall("C:\birra.ico",@TempDir & "\birra.ico") GUISetIcon(@TempDir & "\birra.ico", -1) Global $sFileToCheck = "\\192.168.1.155\cond\chat.txt" Global $bFileChanged = False Global $sFileDateTime = _ArrayToString(FileGetTime($sFileToCheck)) AdlibRegister("_CheckFile", 250) $FormComunicazioni = GUICreate("NAME CHAT", 450, 500, -1, -1) GUISetBkColor($COLOR_BLACK) GUISetFont(11, 400, 0, "Calibri") $EditComunicazioni = GUICtrlCreateEdit("",20, 20, 410, 350, BitOR($ES_READONLY, $CBS_AUTOHSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "- Chat" & " " & @MDAY & "\" & @MON & "\" & @YEAR) $AggiornaComunicazioni = GUICtrlCreateButton("recupera conversazione iniziale", 20, 385, 200, 30) $edit = GUICtrlCreateEdit("", 20, 430, 340, 55, BitOR($CBS_AUTOHSCROLL, $WS_VSCROLL)) $invia = GUICtrlCreateButton("Invia", 365, 428, 67, 58) GUISetState(@SW_SHOW) While 1 Sleep(10) If $bFileChanged Then $file= FileOpen ("\\192.168.1.155\cond\chat.txt",0) $last_line = FileReadLine ($file, -1) _GUICtrlEdit_AppendText($EditComunicazioni, @CRLF & $last_line) FileClose($file) $sFileDateTime = _ArrayToString(FileGetTime($sFileToCheck)) $bFileChanged = False TrayTip("Stranguglie e previdi", "è presente un nuovo messaggio", 0, $TIP_ICONASTERISK) GUISetState(@SW_RESTORE) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $invia ClipPut(GUICtrlRead($edit)) FileWrite("\\192.168.1.155\cond\chat.txt", @CRLF & "[" & @UserName & "]" & " scrive: " & ClipGet()) Sleep(100) Guictrlsetdata($edit,"") Case $AggiornaComunicazioni $file = FileOpen("\\192.168.1.155\cond\chat.txt", 0) $FileContent = FileRead($file) _GUICtrlEdit_AppendText($EditComunicazioni, @CRLF & @CRLF & $FileContent) FileClose($file) GUICtrlSetState($AggiornaComunicazioni, $GUI_DISABLE) EndSwitch WEnd DllClose($hDLL) Func _CheckFile() If $sFileDateTime <> _ArrayToString(FileGetTime($sFileToCheck)) Then $bFileChanged = True EndFunc  
    • DeeJay7
      By DeeJay7
      I'm in a requirement to:
      Open multiple files in multiple directories (not all files are .txt files, some are .ini, some without extension). Example: c:\dir\subdir\file1, c:\dir\subdir\file2.ini, c:\dir2\file3 Find 5 or 6 text strings in above files, string may contain special characters (Ex: %hostname%_a1234) Replace them with new string values Take backup of old files and save the updated files. I've tried few scripts and couldn't get the solution.
      Appreciate if anybody could help me to achieve this script.
      Thanks in advance.