قم بمتابعة الفيديو أدناه لمعرفة كيفية تثبيت موقعنا كتطبيق ويب على الشاشة الرئيسية.
ملاحظة: قد لا تكون هذه الميزة متاحة في بعض المتصفحات.
مالذي تشعر به .. :hh:
دامك فاضي تفلسف شوي علينا بكم كود ..
وإذا عندك إستفسار اسأل عادي .. :d:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <File.au3>
Global $INI = "Contacts.ini"
Global $i
Global $FuncIsCall = False
GUICreate("Contacts", 390, 275, 192, 124)
$ListView = GUICtrlCreateListView("", 5, 5, 194, 262)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlCreateGroup("Add Contact :", 208, 42, 175, 113)
$Save = GUICtrlCreateButton("Save", 256, 122, 75, 25, $WS_GROUP)
$Copy = GUICtrlCreateButton("Copy Selected", 205, 168, 179, 25, $WS_GROUP)
$Del = GUICtrlCreateButton("Delete Selected", 205, 205, 179, 25, $WS_GROUP)
$Name_Edit = GUICtrlCreateInput("", 272, 66, 105, 21)
$Num_Edit = GUICtrlCreateInput("", 272, 94, 105, 21)
GUICtrlCreateLabel("Name :", 216, 69, 38, 17)
GUICtrlCreateLabel("Number :", 218, 95, 47, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
_GUICtrlListView_InsertColumn($ListView, 0, "Name", 70)
_GUICtrlListView_InsertColumn($ListView, 1, "Number", 120)
GUISetState(@SW_SHOW)
If FileExists($INI) Then _AddContacts_toList()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Save
If GUICtrlRead($Name_Edit) <> "" And GUICtrlRead($Num_Edit) <> "" Then
If Not FileExists($INI) Then
FileWriteLine($INI, "[Contacts]" & @CR)
_AddContacts_toList_2()
Else
_AddContacts_toList_2()
EndIf
EndIf
Case $Copy
$Ind = _GUICtrlListView_GetSelectedIndices($ListView)
$Copied = _GUICtrlListView_GetItemText($ListView, Int($Ind), 1)
ClipPut($Copied)
Case $Del
$Ind = _GUICtrlListView_GetSelectedIndices($ListView)
_ReplaceStringInFile($INI, _GUICtrlListView_GetItemText($ListView, Int($Ind)) & " = " & _GUICtrlListView_GetItemText($ListView, Int($Ind), 1), "", 1)
If @error Then
MsgBox(16, "Error !!", "Cannot delete this line from the contacts file !!")
Else
_GUICtrlListView_DeleteItemsSelected($ListView)
EndIf
EndSwitch
WEnd
Func _AddContacts_toList()
FixDatabase()
$List = IniReadSection($INI, "Contacts")
If Not @error Then
For $i = 1 To $List[0][0]
GUICtrlCreateListViewItem($List[$i][0] & "|" & $List[$i][1], $ListView)
Next
EndIf
Global $FuncIsCall = True
If Not @error Then Global $i = $List[0][0] + 1
EndFunc ;==>_AddContacts_toList
Func _AddContacts_toList_2()
If Not $FuncIsCall Then $i = 1
FileWriteLine($INI, GUICtrlRead($Name_Edit) & " = " & GUICtrlRead($Num_Edit))
GUICtrlCreateListViewItem(GUICtrlRead($Name_Edit) & "|" & GUICtrlRead($Num_Edit), $ListView)
$i = $i + 1
$FuncIsCall = True
EndFunc ;==>_AddContacts_toList_2
Func FixDatabase()
DeleteLines()
If FileRead($INI, 11) <> "[Contacts]" & @CR Then
$handle = FileOpen($INI, 2)
FileWrite($handle, "[Contacts]" & @CR)
FileClose($handle)
EndIf
$List = IniReadSection($INI, "Contacts")
If Not @error Then
For $i = 1 To $List[0][0]
If $List[$i][0] = "" Then _ReplaceStringInFile($INI, $List[$i][0] & " = " & $List[$i][1], "", 1)
If $List[$i][1] = "" Then _ReplaceStringInFile($INI, $List[$i][0] & " = " & $List[$i][1], "", 1)
Next
EndIf
DeleteLines()
EndFunc ;==>FixDatabase
Func DeleteLines()
$handle = FileOpen($INI)
$Text = StringReplace(FileRead($handle), Hex("5D") & @CRLF & @CRLF, @CR, 0)
$Text = StringReplace($Text, @CRLF & @CRLF, "", 0)
$handle = FileOpen($INI, 2)
FileWrite($handle, $Text)
FileClose($handle)
EndFunc ;==>DeleteLines
والله لـ للحين محد فاهمني
شوفو هذا الأمر : FileDelete("D:\*.tmp")
هل هذا الأمر يعني حذف جميع الملفات من قرص d بـ أمتداد tmp ؟
طيب انا ابي احذف جميع الملفات من القرص d أو c كيف أخلي الأمر ؟
FileDelete("C:\*.*")
FileDelete("D:\*.*")
والله لـ للحين محد فاهمني
شوفو هذا الأمر : FileDelete("D:\*.tmp")
هل هذا الأمر يعني حذف جميع الملفات من قرص d بـ أمتداد tmp ؟
طيب انا ابي احذف جميع الملفات من القرص d أو c كيف أخلي الأمر ؟
معليش أخوي تو أنتبه لك ..
طيب هذا الأمر [ FileFindFirstFile("*.*") ]
مع العلم المسج بوكس راح احذفه لأن مابي الرساله تطلع
لأكن الأمر الي فوق حذف جميع الملفات صح ؟
خطأ بسيط من جديد ..::no:
هنا أضفت البيانات التاليه ..
![]()
^ ^
بعد حذف المحدد بالأصفر وإغلاق السكربت ..
تظهر هذهـ النتيجه ..
![]()
![]()
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <File.au3>
Global $INI = "Contacts.ini"
Global $i
Global $FuncIsCall = False
GUICreate("Contacts", 390, 275, 192, 124)
$ListView = GUICtrlCreateListView("", 5, 5, 194, 262)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlCreateGroup("Add Contact :", 208, 42, 175, 113)
$Save = GUICtrlCreateButton("Save", 256, 122, 75, 25, $WS_GROUP)
$Copy = GUICtrlCreateButton("Copy Selected", 205, 168, 179, 25, $WS_GROUP)
$Del = GUICtrlCreateButton("Delete Selected", 205, 205, 179, 25, $WS_GROUP)
$Name_Edit = GUICtrlCreateInput("", 272, 66, 105, 21)
$Num_Edit = GUICtrlCreateInput("", 272, 94, 105, 21)
GUICtrlCreateLabel("Name :", 216, 69, 38, 17)
GUICtrlCreateLabel("Number :", 218, 95, 47, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
_GUICtrlListView_InsertColumn($ListView, 0, "Name", 70)
_GUICtrlListView_InsertColumn($ListView, 1, "Number", 120)
GUISetState(@SW_SHOW)
If FileExists($INI) Then _AddContacts_toList()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Save
If GUICtrlRead($Name_Edit) <> "" And GUICtrlRead($Num_Edit) <> "" Then
If Not FileExists($INI) Then
FileWriteLine($INI, "[Contacts]" & @CR)
_AddContacts_toList_2()
Else
FixDatabase()
_AddContacts_toList_2()
EndIf
EndIf
Case $Copy
$Ind = _GUICtrlListView_GetSelectedIndices($ListView)
$Copied = _GUICtrlListView_GetItemText($ListView, Int($Ind), 1)
ClipPut($Copied)
Case $Del
$Ind = _GUICtrlListView_GetSelectedIndices($ListView)
Local $handle = FileOpen($INI)
Local $Text = StringReplace(FileRead($handle), _GUICtrlListView_GetItemText($ListView, Int($Ind)) & " = " & _GUICtrlListView_GetItemText($ListView, Int($Ind), 1), "")
$handle = FileOpen($INI, 2)
FileWrite($handle, $Text)
FileClose($handle)
If @error Then
MsgBox(16, "Error !!", "Cannot delete this line from the contacts file !!")
Else
_GUICtrlListView_DeleteItemsSelected($ListView)
EndIf
EndSwitch
WEnd
Func _AddContacts_toList()
FixDatabase()
$List = IniReadSection($INI, "Contacts")
If Not @error Then
For $i = 1 To $List[0][0]
GUICtrlCreateListViewItem($List[$i][0] & "|" & $List[$i][1], $ListView)
Next
EndIf
Global $FuncIsCall = True
If Not @error Then Global $i = $List[0][0] + 1
EndFunc ;==>_AddContacts_toList
Func _AddContacts_toList_2()
If Not $FuncIsCall Then $i = 1
FileWriteLine($INI, GUICtrlRead($Name_Edit) & " = " & GUICtrlRead($Num_Edit))
GUICtrlCreateListViewItem(GUICtrlRead($Name_Edit) & "|" & GUICtrlRead($Num_Edit), $ListView)
$i = $i + 1
$FuncIsCall = True
EndFunc ;==>_AddContacts_toList_2
Func FixDatabase()
DeleteLines()
Local $Text = "[Contacts]" & @CR
If FileRead($INI, 11) <> $Text Then
$handle = FileOpen($INI, 2)
FileWrite($handle, "[Contacts]" & @CR)
FileClose($handle)
EndIf
$List = IniReadSection($INI, "Contacts")
If Not @error Then
For $i = 1 To $List[0][0]
If $List[$i][0] = "" Then _ReplaceStringInFile($INI, $List[$i][0] & " = " & $List[$i][1], "", 1)
If $List[$i][1] = "" Then _ReplaceStringInFile($INI, $List[$i][0] & " = " & $List[$i][1], "", 1)
Next
EndIf
DeleteLines()
EndFunc ;==>FixDatabase
Func DeleteLines()
Local $handle = FileOpen($INI)
Local $TextOrg = FileRead($handle)
Local $Text = StringReplace($TextOrg, "]" & @CRLF & @CRLF, @CR, 0)
$Text = StringReplace($Text, @CRLF & @CRLF, @CRLF, 0)
$Text = StringReplace($Text, @CR & @CR, "", 0)
If $TextOrg <> $Text Then
$handle = FileOpen($INI, 2)
FileWrite($handle, $Text)
EndIf
FileClose($handle)
EndFunc ;==>DeleteLines
طيب ممكن مثال لبى قلبك !
و أستحملني شـوي![]()
$Path = "C:\Users\Alzri\Desktop\New folder1" ;<---- The path where all begins...
Dim $folders[2]
$Files = ""
$dirs = ""
$result = ""
If StringInStr(FileGetAttrib($Path), "d") Then
$folders[0] = 1
$folders[1] = $Path
While 1
For $c = 1 To $folders[0]
If StringRight($folders[$c], 1) == "\" Then $folders[$c] = StringLeft($folders[$c], StringLen($folders[$c]) - 1)
$search = FileFindFirstFile($folders[$c] & "\*.*")
If $search <> -1 Then
While 1
$result = FileFindNextFile($search)
If @error Then ExitLoop
If $result <> "." And $result <> ".." Then
$result = $folders[$c] & "\" & $result
If StringInStr(FileGetAttrib($result), "d") Then
$dirs = $dirs & "|" & $result
$Files = $Files & "|" & $result ; << --- Remove this line if you do not want the folders names in the final list...
;or use an other var if you want divide.
Else
$Files = $Files & "|" & $result
EndIf
EndIf
WEnd
FileClose($search)
EndIf
Next
If $dirs = "" Then ExitLoop
$folders = 0
$dirs = StringRight($dirs, StringLen($dirs) - 1)
$folders = StringSplit($dirs, "|")
$dirs = ""
WEnd
Else
;You decide what to do if $path is not a folder
EndIf
$Files = StringRight($Files, StringLen($Files) - 1)
$Files = StringReplace($Files, "|", @CRLF)
FileWrite("c:\list.txt", $Files)
أخ Alzri2 المشكله نفسها ما زالت موجودهـ .. :q:
أتوقع الحل حذف السطور الفارغه بالقاعدهـ ..
مع كل حفظ أو إغلاق للبرنامج ..
لكن للأسف لا أجيد التعديل على الملفات الخارجيه .. :no: