mucitbey Posted January 30, 2020 Posted January 30, 2020 Hello,I would like to import the data saved in the ini file of the program that I prepared with your help before to Excel. For example, I share some of the ini file and my codes.Thanks to Autoit lovers who will help. #include <Excel.au3> Global $Roww, $City, $Vill, $Strt, $Strt, $Iden, $Name, $Damg, $Expl, $pEdit $Roww = IniRead("AnKcSbData.ini", $Roww, "Roww", "Not Found") $City = IniRead("AnKcSbData.ini", $Roww, "City", "Not Found") $Vill = IniRead("AnKcSbData.ini", $Roww, "Vill", "Not Found") $Strt = IniRead("AnKcSbData.ini", $Roww, "Strt", "Not Found") $Iden = IniRead("AnKcSbData.ini", $Roww, "Iden", "Not Found") $Name = IniRead("AnKcSbData.ini", $Roww, "Name", "Not Found") $Fath = IniRead("AnKcSbData.ini", $Roww, "Fath", "Not Found") $Damg = IniRead("AnKcSbData.ini", $Roww, "Damg", "Not Found") $Expl = IniRead("AnKcSbData.ini", $Roww, "Expl", "Not Found") Local $aArray[3][9] = [[$Roww], [$City], [$Vill], [$Strt], [$Iden], [$Name], [$Fath], [$Damg], [$Expl]] Local $oExcel = _Excel_Open() Local $oBook = _Excel_BookNew($oExcel, 1) $oBook.Activesheet.Range("A1:I9").Value = $aArray AnKcSbData.ini [1] Roww=1 City=NEWYORK / Kaliforniya Vill=Rose Street Strt=Duncan Road Iden=000000000000 Name=George MICHEAL Fath=Jarry Damg=Heavily Damaged Expl=Nothig. [2] Roww=2 City=ABD / Texas Vill=Houston Street Strt=Austin Road Iden=111111111111 Name=Jerry Lewis Fath=Jones Damg=Slightly Damaged Expl=Repairable. [3] Roww=3 City= Vill= Strt= Iden= Name= Fath= Damg= Expl=
water Posted January 30, 2020 Posted January 30, 2020 And your question is? My UDFs and Tutorials: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
mucitbey Posted January 30, 2020 Author Posted January 30, 2020 On 1/30/2020 at 8:47 AM, water said: And your question is? Expand My problem is that I did not get successful results with these codes. I want help with correction or a different method on my code.
Subz Posted January 30, 2020 Posted January 30, 2020 Try: #include <Excel.au3> Global $sAnKcSbData = @ScriptDir & "\AnKcSbData.ini" Global $aSectionNames = IniReadSectionNames($sAnKcSbData) If @error Then Exit MsgBox(4096, "Error", "Error Reading Seciton Names") Global $aAnKcSbData[$aSectionNames[0] + 1][9] For $i = 1 To $aSectionNames[0] $aAnKcSbData[$i - 1][0] = IniRead($sAnKcSbData, $aSectionNames[$i], "Roww", "Not Found") $aAnKcSbData[$i - 1][1] = IniRead($sAnKcSbData, $aSectionNames[$i], "City", "Not Found") $aAnKcSbData[$i - 1][2] = IniRead($sAnKcSbData, $aSectionNames[$i], "Vill", "Not Found") $aAnKcSbData[$i - 1][3] = IniRead($sAnKcSbData, $aSectionNames[$i], "Strt", "Not Found") $aAnKcSbData[$i - 1][4] = IniRead($sAnKcSbData, $aSectionNames[$i], "Iden", "Not Found") $aAnKcSbData[$i - 1][5] = IniRead($sAnKcSbData, $aSectionNames[$i], "Name", "Not Found") $aAnKcSbData[$i - 1][6] = IniRead($sAnKcSbData, $aSectionNames[$i], "Fath", "Not Found") $aAnKcSbData[$i - 1][7] = IniRead($sAnKcSbData, $aSectionNames[$i], "Damg", "Not Found") $aAnKcSbData[$i - 1][8] = IniRead($sAnKcSbData, $aSectionNames[$i], "Expl", "Not Found") Next Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oWorkbook, Default, $aAnKcSbData) mucitbey 1
mucitbey Posted January 30, 2020 Author Posted January 30, 2020 On 1/30/2020 at 9:34 AM, Subz said: Try: #include <Excel.au3> Global $sAnKcSbData = @ScriptDir & "\AnKcSbData.ini" Global $aSectionNames = IniReadSectionNames($sAnKcSbData) If @error Then Exit MsgBox(4096, "Error", "Error Reading Seciton Names") Global $aAnKcSbData[$aSectionNames[0] + 1][9] For $i = 1 To $aSectionNames[0] $aAnKcSbData[$i - 1][0] = IniRead($sAnKcSbData, $aSectionNames[$i], "Roww", "Not Found") $aAnKcSbData[$i - 1][1] = IniRead($sAnKcSbData, $aSectionNames[$i], "City", "Not Found") $aAnKcSbData[$i - 1][2] = IniRead($sAnKcSbData, $aSectionNames[$i], "Vill", "Not Found") $aAnKcSbData[$i - 1][3] = IniRead($sAnKcSbData, $aSectionNames[$i], "Strt", "Not Found") $aAnKcSbData[$i - 1][4] = IniRead($sAnKcSbData, $aSectionNames[$i], "Iden", "Not Found") $aAnKcSbData[$i - 1][5] = IniRead($sAnKcSbData, $aSectionNames[$i], "Name", "Not Found") $aAnKcSbData[$i - 1][6] = IniRead($sAnKcSbData, $aSectionNames[$i], "Fath", "Not Found") $aAnKcSbData[$i - 1][7] = IniRead($sAnKcSbData, $aSectionNames[$i], "Damg", "Not Found") $aAnKcSbData[$i - 1][8] = IniRead($sAnKcSbData, $aSectionNames[$i], "Expl", "Not Found") Next Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oWorkbook, Default, $aAnKcSbData) Expand Thanks # Subz # Its works
mucitbey Posted February 7, 2020 Author Posted February 7, 2020 Hello again, Is it possible to filter the transfer process as follows? for example, you only send all of the data (City = USA / Texas). Can you help it become this? Thank you.
Nine Posted February 7, 2020 Posted February 7, 2020 One way : #include <Excel.au3> Global $sAnKcSbData = @ScriptDir & "\AnKcSbData.ini" Global $aSectionNames = IniReadSectionNames($sAnKcSbData) If @error Then Exit MsgBox(4096, "Error", "Error Reading Seciton Names") Global $aAnKcSbData[$aSectionNames[0] + 1][9], $iCount = 0 For $i = 1 To $aSectionNames[0] $aAnKcSbData[$iCount][0] = IniRead($sAnKcSbData, $aSectionNames[$i], "Roww", "Not Found") $aAnKcSbData[$iCount][1] = IniRead($sAnKcSbData, $aSectionNames[$i], "City", "Not Found") $aAnKcSbData[$iCount][2] = IniRead($sAnKcSbData, $aSectionNames[$i], "Vill", "Not Found") $aAnKcSbData[$iCount][3] = IniRead($sAnKcSbData, $aSectionNames[$i], "Strt", "Not Found") $aAnKcSbData[$iCount][4] = IniRead($sAnKcSbData, $aSectionNames[$i], "Iden", "Not Found") $aAnKcSbData[$iCount][5] = IniRead($sAnKcSbData, $aSectionNames[$i], "Name", "Not Found") $aAnKcSbData[$iCount][6] = IniRead($sAnKcSbData, $aSectionNames[$i], "Fath", "Not Found") $aAnKcSbData[$iCount][7] = IniRead($sAnKcSbData, $aSectionNames[$i], "Damg", "Not Found") $aAnKcSbData[$iCount][8] = IniRead($sAnKcSbData, $aSectionNames[$i], "Expl", "Not Found") If $aAnKcSbData[$iCount][1] = "USA / Texas" Then $iCount += 1 ; put all the conditions you want on this line Next ReDim $aAnKcSbData[$iCount][9] Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oWorkbook, Default, $aAnKcSbData) mucitbey 1 “They did not know it was impossible, so they did it” ― Mark Twain Reveal hidden contents Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Moderators JLogan3o13 Posted February 7, 2020 Moderators Posted February 7, 2020 Moved to the appropriate forum. Moderation Team "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now