Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

is my way of coding correct? my process is slow.

$
0
0
Hi, im making a program that converts the content of .CSV file to HTML view,
the code is working fine but im having trouble in on the time of convertion,
sometimes my convertion is fast and sometimes it takes time..

im thinking maybe my coding is wrong, that why im going to ask, did i code in the right way?

.....
.....
.....
; this is my main loop $lines=around 50,000
for $x=$lines to 1 step -1
  $y=$y+1
  if $stop=1 then ExitLoop
  $pr=(100*(($lines-$x)/$lines))+1
  progbar($pr,$pr,$t,$y)
  if $stop=1 then Return
  
  if ($arr[($x*7)-4]="") then
   $sender=$arr[($x*7)-5]
  Else
   $sender=$arr[($x*7)-4]
  EndIf
 
  if $arr[($x*7)-6]=" Received " then
   $co="blue"
  Else
   $co="red"
  EndIf
 
  for $z=1 to $pb[0][0]
   if StringInStr($pb[$z][0],$sender) then
	$t=$t+1
	$sender="<b>"&$pb[$z][1]&"</b>"
	$f="<tr><td>"&$t&"</td><td>"&$sender&"</td><td><center><font color="&$co&">"&$arr[($x*7)-6]&"</font></td><td><center>"&$arr[($x*7)-2]&"</td><td>"&$arr[$x*7]&"</td></tr>"&@crlf&$f
	ExitLoop
   endif
  Next
 
Next
.....
....
.....
func progbar($x=0,$y=0,$n="",$nt="")
$x=int($x)
$y=int($y)
if not($pp1prev=$x) then
  GUICtrlSetData($pp1,$x)
  GUICtrlSetData($p1,$x)
  GUICtrlSetData($num,$n)
  GUICtrlSetData($numt,$nt)
  $pp1prev=$x
EndIf

if not($pp2prev=$y) then
  GUICtrlSetData($pp2,$y)
  GUICtrlSetData($p2,$y)
  $pp2prev=$y
EndIf

$msg=GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE then
  MsgBox(0,"","User Canceled",5)
  $stop=1 
  progclose()
EndIf
EndFunc


:: sometimes it is slow, sometimes it is fast, without any changes in another programs, activated or closed.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>