; Define Variables Global $filePath, $numPup, $fileHwnd, $frDowns, $enDowns, $fileCont, $fileSep, $I, $sepSize, $II, $rndS, $spHwnd, $chgPnts, $nTxt, $filePath2, $fHwnd ; Setting Students number * 3 ( Because there is Supervisor Mark, 1st and 2nd Exam Mark ) $numPup = InputBox("برنامج النقاط 2", "ما هو عدد التلاميذ") * 3 ; Defining array as longer as students number Global $pnts[$numPup] ; Changed section to open from downloads folder ;$enDowns = @UserProfileDir & "\Downloads" ;$frDowns = @UserProfileDir & "\Téléchargement" ;If (FileExists($enDowns)) Then ;$filePath = FileOpenDialog("إختر ملف الرقمنة", $enDowns, "ملف نقاط (*.men)", 1) ;Elseif (FileExists($frDowns)) Then ;$filePath = FileOpenDialog("إختر ملف الرقمنة", $frDowns, "ملف نقاط (*.men)", 1) ;Else ;$filePath = FileOpenDialog("إختر ملف الرقمنة", @DesktopDir, "ملف نقاط (*.men)", 1) ;Endif Local $myFolder = getDownloadFolder() $filePath = FileOpenDialog("إختر ملف الرقمنة", $myFolder, "ملف نقاط (*.men)", 1) ; Please Wait Screen Because Script Is FAAAAAAAST $spHwnd = SplashTextOn("برنامج النقاط 2", "يرجى الإنتظار قليلًا من فضلك") ;يرجى الإنتظار قليلًا من فضلك = Please Wait Some Time $rndS = Random(800, 3200) Sleep($rndS) ; Reading File And Spliting - See File To UnderStand What Splitted $fileHwnd = FileOpen($filePath ,0) $fileCont = FileRead($fileHwnd) $fileSep = StringSplit($fileCont, '"edit_num(this.id)">', 1) ; Close File To Free Memory In Case The File Is Large FileClose($fileHwnd) ; Defining Loop Variables $sepSize = UBOUND($fileSep) $I = 2 $II = 1 $III = 0 ; Use This Loop To See Results Of Split ; While ($I < $sepSize) ; MsgBx($fileSep[$i]) ; $I += 1 ; Wend ; Starting From 3rd Seperated Element, Because 1st and 2nd are empty ): $I = 2 While ($I < $numPup) Local $endStr ; Get The Number Value, Every Seperated Starts With a Number That's a Mark $endStr = Number($fileSep[$I]) ; Old Bad Syntax ; $endStr = "" ; If StringIsInt(StringMid($fileSep[$I], 0, 1)) or StringMid($fileSep[$I], 0, 1) == "." or StringMid($fileSep[$I], 0, 1) == "." Then ; $endStr = $endStr & StringMid($fileSep[$I], 0, 1) ; Endif ; If StringIsInt(StringMid($fileSep[$I], 1, 2)) or StringMid($fileSep[$I], 1, 2) == "." or StringMid($fileSep[$I], 1, 2) == "." Then ; $endStr = $endStr & StringMid($fileSep[$I], 1, 2) ; Endif ; If StringIsInt(StringMid($fileSep[$I], 2, 3)) or StringMid($fileSep[$I], 2, 3) == "." or StringMid($fileSep[$I], 2, 3) == "." Then ; $endStr = $endStr & StringMid($fileSep[$I], 2, 3) ; Endif ; Well, That's Hard To Explain, But Every 3 Numbers The 3RD One Should Be Multiplicated in 3 (x3), So That's Just What I Did Here If $II = 1 Or $II = 2 Then $pnts[$III] = $endStr $II += 1 Else $pnts[$III] = $endStr * 3 $II = 1 Endif $III += 1 $I += 1 Wend $I = 0 $II = 1 ; Turning Off The "Please Wait Screen" If Processed Infos SplashOff() ; Display Marks And If Some Mark Is Incorrect Correct It And ReSave The File With Same Form While ($I < $numPup) Local $ResBx, $cPnt $ResBx = MsgBox(3, Int($I / 3) + 1, $pnts[$I]) If $ResBx = 2 Then Exit Elseif $ResBx = 7 Then If $II = 1 Or $II = 2 Then $cPnt = InputBox("برنامج النقاط", "أدخل النقطة الصحيحة", 0, " M") $II += 1 Else $cPnt = InputBox("برنامج النقاط", "أدخل النقطة الصحيحة", 0, " M") / 3 $II = 1 Endif $pnts[$I] = $cPnt $chgPnts = true Endif $I += 1 Wend $I = 1 ; If Changed Some Mark ReMake The File With Corrected Marks If $chgPnts == True Then While ($I < $sepSize) $nTxt &= $fileSep[$I] If $I <> $sepSize - 1 Then $nTxt &= '"edit_num(this.id)">' Endif $I += 1 Wend ; Optimized syntax $filePath = FileOpenDialog("إختر ملف الرقمنة", $myFolder, "ملف نقاط (*.men)", 1) ; Saving File $fHwnd = FileOpen($filePath2, 10) FileWrite($fHwnd, $nTxt) FileClose Endif Func MsgBx($texty) MsgBox(0, "برنامج النقاط 2", $texty) EndFunc Func getDownloadFolder() Local $downloadFolders[]=[@UserProfileDir & "\Downloads", _ @UserProfileDir & "\Téléchargement", _ @DesktopDir] For $i = 0 To UBound($downloadFolders) - 1 If (FileExists($downloadFolders[$i])) Then return $downloadFolders[$i] Next EndFunc