Jump to content

price98

Active Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by price98

  1. Thanks for suggestions. I did something. But I am getting following error line(264) : ==> The requested action with this object has failed.: $AdoCon.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & $pathToDB) $AdoCon^ ERROR Can anyone resolve this problem? Thanks gui1.au3 Database4.accdb
  2. hi, I have add files to MS Access. Previously one of member of this forum help me upto here. In the below file, Its adding only text of file name. But i have to add whole file. Can anyone help me? gui.au3 Database4.accdb
  3. hi Here i am adding only file name to the database. How can I add whole file? Thanks.
  4. @Subz hi, i am getting following error.How to resolve it? "C:\Users\price98\Desktop\Neuer Ordner\gui.au3" (101) : ==> The requested action with this object has failed.: $Files[$i] = $AdoRs.Fields(1).Value $Files[$i] = $AdoRs.Fields(1)^ ERROR thanks
  5. hi, Here I have 3 attributes named as " Simulator, Testing, Controller". I am adding new file. After adding new file , I have to give particular attribute to new file. How to give particular attribute to the new file? Thanks
  6. thanks @Subz Its working.Can you write comments in the program? I can understand easily. Thanks
  7. now it is adding like this ID FELD1 56 C: 57 C: 58 C: 59 C:
  8. Now it is adding like (see image)
  9. thanks.Its working only when i changed this one Global $DB_Name = "Database4.accdb" to this Global $DB_Name = "C:\Users\price98\Desktop\Neuer Ordner\Database4.accdb". The file is adding to database like C:\Users\price98\Desktop\Neuer Ordner\test13.txt. But I need only test13.txt Can anyone help me?
  10. thanks for your reply
  11. thanks for reply. After choosing file, i am getting below error $AdoCon.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & $DB_Name) $AdoCon^ ERROR
  12. hi, i have to add new files to list and database.accdb (see below qqq.png file). Can anyone help me? Thanks #include <GUIConstantsEx.au3> #include <GuiListBox.au3> Local $DB_Name = "Database4.accdb" Local $Table_Name = "bhanu" Local $Attr_Name[3] = ["", "", ""] $AdoCon = ObjCreate("ADODB.Connection") $AdoCon.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & $DB_Name) $AdoRs = ObjCreate("ADODB.Recordset") $AdoRs.CursorType = 1 $AdoRs.LockType = 3 $AdoRs.Open("SELECT COUNT(*) FROM " & $Table_Name, $AdoCon) $dimension = $AdoRs.Fields(0).Value Global $Files[$dimension] Global $File_Attr[$dimension][3] For $i = 0 To UBound($Files) - 1 Step 1 $AdoRs = ObjCreate("ADODB.Recordset") $AdoRs.CursorType = 1 $AdoRs.LockType = 3 $AdoRs.Open("SELECT * FROM " & $Table_Name & " WHERE ID = " & ($i + 1), $AdoCon) $Files[$i] = $AdoRs.Fields(1).Value $File_Attr[$i][0] = $AdoRs.Fields(2).Value $File_Attr[$i][1] = $AdoRs.Fields(3).Value $File_Attr[$i][2] = $AdoRs.Fields(4).Value Next $AdoCon.Close Local $a = 0 For $i = 0 To UBound($Files) - 1 Step 1 For $j = 0 To 2 Step 1 If $a < 3 And Not $File_Attr[$i][$j] = "" Then For $k = $a To 2 Step 1 If $Attr_Name[$k] = $File_Attr[$i][$j] Then ContinueLoop 2 EndIf Next $Attr_Name[$a] = $File_Attr[$i][$j] $a = $a + 1 EndIf Next Next $Form_Main = GUICreate("GUI managing Database", 250, 380) $Group_Attributes = GUICtrlCreateGroup("Attributes", 20, 20, 200, 130) $Checkbox_1 = GUICtrlCreateCheckbox($Attr_Name[0], 40, 50) $Checkbox_2 = GUICtrlCreateCheckbox($Attr_Name[1], 40, 80) $Checkbox_3 = GUICtrlCreateCheckbox($Attr_Name[2], 40, 110) $Group_Files = GUICtrlCreateGroup("Files", 20, 160, 200, 200) $List = GUICtrlCreateList("", 40, 180, 180, 180) GUISetState(@SW_SHOW) ; GUI loop While 1 $msg = GUIGetMsg() Switch $msg Case $Checkbox_1, $Checkbox_2, $Checkbox_3 GUICtrlSetData($List, "") Access($Checkbox_1) Access($Checkbox_2) Access($Checkbox_3) Case $GUI_EVENT_CLOSE ; Close GUI ExitLoop EndSwitch WEnd Func Access($Checkbox) If GUICtrlRead($Checkbox) = $GUI_CHECKED Then Local $Chkbox_label = GUICtrlRead($Checkbox, 1) For $i = 0 To UBound($Files) - 1 Step 1 If $File_Attr[$i][0] = $Chkbox_label Or $File_Attr[$i][1] = $Chkbox_label Or $File_Attr[$i][2] = $Chkbox_label Then _GUICtrlListBox_AddString($List, $Files[$i]) EndIF Next EndIF EndFunc Database4.accdb
  13. hi, I done upto here. Here I done for 3 files(static), If i have to do infinity number of files(dynamically). How to do? And after clicking controller checkbox, How to list the files? Can anyone help me? Thanks #include <GUIConstantsEx.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DB DATA ;;;;;;;;;;;;;;;;;;:::;;;;;;;;;;;;;;;; Local $DB_Name = "Database4.accdb" Local $Table_Name = "bhanu" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; VARIABLES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; File names Global $Files[3] = ["", "", ""] ; Files attributes Global $File_Attr[3][3] ; Attribute names Local $Attr_Name[3] = ["", "", ""] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROGRAM BODY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; DB read $AdoCon = ObjCreate("ADODB.Connection") $AdoCon.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & $DB_Name) For $i = 0 To 2 Step 1 $AdoRs = ObjCreate("ADODB.Recordset") $AdoRs.CursorType = 1 $AdoRs.LockType = 3 $AdoRs.Open("SELECT * FROM " & $Table_Name & " WHERE ID = " & ($i + 1), $AdoCon) $Files[$i] = $AdoRs.Fields(1).Value $File_Attr[$i][0] = $AdoRs.Fields(2).Value $File_Attr[$i][1] = $AdoRs.Fields(3).Value $File_Attr[$i][2] = $AdoRs.Fields(4).Value Next $AdoCon.Close ; Attributes implode Local $a = 0 For $i = 0 To 2 Step 1 For $j = 0 To 2 Step 1 If $a < 3 And Not $File_Attr[$i][$j] = "" Then For $k = $a To 2 Step 1 If $Attr_Name[$k] = $File_Attr[$i][$j] Then ContinueLoop 2 EndIf Next $Attr_Name[$a] = $File_Attr[$i][$j] $a = $a + 1 EndIf Next Next ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUI FORM EXAMPLE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Form_Main = GUICreate("GUI managing Database", 250, 380) $Group_Attributes = GUICtrlCreateGroup("Attributes", 20, 20, 200, 130) $Checkbox_1 = GUICtrlCreateCheckbox($Attr_Name[0], 40, 50) $Checkbox_2 = GUICtrlCreateCheckbox($Attr_Name[1], 40, 80) $Checkbox_3 = GUICtrlCreateCheckbox($Attr_Name[2], 40, 110) $Group_Files = GUICtrlCreateGroup("Files", 20, 160, 200, 200) $Label_1 = GUICtrlCreateLabel("", 40, 180, 100, 20) $Label_2 = GUICtrlCreateLabel("", 40, 220, 100, 20) $Label_3 = GUICtrlCreateLabel("", 40, 260, 100, 20) GUISetState(@SW_SHOW) ; GUI loop While 1 $msg = GUIGetMsg() Switch $msg Case $Checkbox_1, $Checkbox_2, $Checkbox_3 GUICtrlSetData($Label_1, "") GUICtrlSetData($Label_2, "") GUICtrlSetData($Label_3, "") Access($Checkbox_1) Access($Checkbox_2) Access($Checkbox_3) Case $GUI_EVENT_CLOSE ; Close GUI ExitLoop EndSwitch WEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FUNCTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func Access($Checkbox) If GUICtrlRead($Checkbox) = $GUI_CHECKED Then Local $Chkbox_label = GUICtrlRead($Checkbox, 1) If $File_Attr[0][0] = $Chkbox_label Or $File_Attr[0][1] = $Chkbox_label Or $File_Attr[0][2] = $Chkbox_label Then GUICtrlSetData($Label_1, $Files[0]) EndIF If $File_Attr[1][0] = $Chkbox_label Or $File_Attr[1][1] = $Chkbox_label Or $File_Attr[1][2] = $Chkbox_label Then GUICtrlSetData($Label_2, $Files[1]) EndIF If $File_Attr[2][0] = $Chkbox_label Or $File_Attr[2][1] = $Chkbox_label Or $File_Attr[2][2] = $Chkbox_label Then GUICtrlSetData($Label_3, $Files[2]) EndIF EndIF EndFunc Database4.accdb
  14. hi, I done upto here. Can anyone tell me how to do from here? #include <GUIConstantsEx.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GIVEN DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; File names Global Const $File_1 = "Test.txt" Global Const $File_2 = "Test2.txt" Global Const $File_3 = "Test3.txt" ; Attribute names Local Const $Attribute_1 = "Controller" Local Const $Attribute_2 = "Simulator" Local Const $Attribute_3 = "Testing" ; Files attributes Global $File_1_Attr[3] = [$Attribute_1, $Attribute_2, $Attribute_3] Global $File_2_Attr[3] = [$Attribute_3, "", ""] Global $File_3_Attr[3] = ["", $Attribute_1, ""] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUI FORM EXAMPLE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Form_Main = GUICreate("GUI managing Database", 250, 380) $Group_Attributes = GUICtrlCreateGroup("Attributes", 20, 20, 200, 130) $Checkbox_1 = GUICtrlCreateCheckbox($Attribute_1, 40, 50) $Checkbox_2 = GUICtrlCreateCheckbox($Attribute_2, 40, 80) $Checkbox_3 = GUICtrlCreateCheckbox($Attribute_3, 40, 110) $Group_Files = GUICtrlCreateGroup("Files", 20, 160, 200, 200) $Label_1 = GUICtrlCreateLabel("", 40, 180, 150, 20) $Label_2 = GUICtrlCreateLabel("", 40, 220, 150, 20) $Label_3 = GUICtrlCreateLabel("", 40, 260, 150, 20) GUISetState(@SW_SHOW) ; Files variablies Global $File_1_Content = "" Global $File_2_Content = "" Global $File_3_Content = "" Global $File_1_Access = False Global $File_2_Access = False Global $File_3_Access = False ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROGRAM BODY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Files content read If Not File_read($File_1) Or Not File_read($File_2) Or Not File_read($File_3) Then Exit EndIf ; Endless loop While 1 ; Checkbox status changed $msg = GUIGetMsg() Switch $msg Case $Checkbox_1, $Checkbox_2, $Checkbox_3 $File_1_Access = False $File_2_Access = False $File_3_Access = False Access($Checkbox_1) Access($Checkbox_2) Access($Checkbox_3) ; Files show If $File_1_Access Then GUICtrlSetData($Label_1, $File_1_Content) Else GUICtrlSetData($Label_1, "") EndIf If $File_2_Access Then GUICtrlSetData($Label_2, $File_2_Content) Else GUICtrlSetData($Label_2, "") EndIf If $File_3_Access Then GUICtrlSetData($Label_3, $File_3_Content) Else GUICtrlSetData($Label_3, "") EndIf Case $GUI_EVENT_CLOSE ; Close GUI ExitLoop EndSwitch WEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func File_read($Filename) Local $hFileOpen = FileOpen($Filename, $FO_READ) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file " & $Filename) Return False EndIf Switch $Filename Case $File_1 $File_1_Content = FileRead($hFileOpen) Case $File_2 $File_2_Content = FileRead($hFileOpen) Case $File_3 $File_3_Content = FileRead($hFileOpen) EndSwitch FileClose($hFileOpen) Return True EndFunc ; Func Access($Checkbox) If GUICtrlRead($Checkbox) = $GUI_CHECKED Then For $vElement In $File_1_Attr If $vElement = GUICtrlRead($Checkbox, $GUI_READ_EXTENDED) Then $File_1_Access = True EndIF Next For $vElement In $File_2_Attr If $vElement = GUICtrlRead($Checkbox, $GUI_READ_EXTENDED) Then $File_2_Access = True EndIF Next For $vElement In $File_3_Attr If $vElement = GUICtrlRead($Checkbox, $GUI_READ_EXTENDED) Then $File_3_Access = True EndIF Next EndIF EndFunc
  15. Can anyone delete previous post
  16. Hi, Here, I am assigning files to required attributes directly(GUI_managing.au3). But, I have to ask database (eg.database.txt) and I have to get it back from database to GUI. Can anyone of you help me ? GUI_managing.au3 GUI_managing.exe
  17. thank you guys for your suggestions
  18. @FrancescoDiMuro I already open that page. I try to open ADO Example Access. It shows like ´ This page is still a work in progress. ´
  19. @FrancescoDiMuro Thanks for suggestion. I am new to autoit. So, I am unable to solve the above problem. Can you give me small example? I have ´ .accdb´ file. In that file the data is present which is shown in above figure. Can I have any chance to edit previous code?
  20. Hi @FrancescoDiMuro, Previously one of our friend helped in this code. At that time , I am doing only for desktop files. I don't know about ADO. Thanks #include <GUIConstantsEx.au3> #include <File.au3> Local $aFileList Local $hGui = GUICreate("ProgramData", 450, 300) Local $hButton_txt = GUICtrlCreateCheckbox("File list TXT", 144, 32, 97, 17) Local $hButton_pdf = GUICtrlCreateCheckbox("File list PDF", 144, 62, 97, 17) Local $hList = GUICtrlCreateList("", 10, 100, 430, 200) GUISetState(@SW_SHOW) $aFileList = _FileListToArray(@DesktopDir, "*.*", 1) ; add your path here While True $sMsg = GUIGetMsg() Switch $sMsg Case -3 Exit Case $hButton_txt, $hButton_pdf $want_txt = IsChecked($hButton_txt) $want_pdf = IsChecked($hButton_pdf) GUICtrlSetData($hList, '') If $want_txt Or $want_pdf Then For $i = 1 To UBound($aFileList) - 1 $ext = StringLower(StringRight($aFileList[$i],4)) If ($want_txt And $ext == '.txt') Or _ ($want_pdf And $ext == '.pdf') Then GUICtrlSetData($hList, $aFileList[$i]) EndIf Next EndIf EndSwitch WEnd Func IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc
  21. Hi, In Microsoft access, I created the database as shown below figure.In autoit, I have to create check boxes named as Controller,Simulator,Testing (as shown in figure). Suppose If I select testing check box then all related files to testing attribute has to shown in database. Can anyone give any idea ? Thanks
  22. Hi, I thought to open new thread to ask previous question.But , I am unable to deleting previous post. Can anyone help me ? Thanks
  23. hi, I do not know this is the right thread to ask this question. In Microsoft access, I created the database as shown below figure.In autoit, I have to create check boxes named as Controller,Simulator,Testing (as shown in figure). Suppose If I select testing check box then all related files to testing attribue has to shown in database. Can anyone give any idea ? Thanks
  24. thanks @Zedna @Melba23
  25. Melba 23, Sorry for that . I thought , I can continue there. I can add second checkbox, but i have to know how to separate two check boxes for two different file types ? Thanks
×
×
  • Create New...