Jump to content

Recommended Posts

Posted

Hi,

I want to put Progress bar in For loop

#include <File.au3>

$message = "Open Log file..."

$PATH = FileOpenDialog($message, @WorkingDir & "\", "Log (*.log)", 1 + 4 )
If @error Then Exit

$search = InputBox("Search", "What to serch for", "")

$FILE = FileOpen($PATH, 0)

For $INDEX = 1 To _FileCountLines($PATH)
$LINE = FileReadLine($FILE,$INDEX)
$FIND = StringInStr($LINE,$search)
If Not @error And $FIND <> 0 Then MsgBox(48,"Found!",$LINE)
Next

FileClose($FILE)

MsgBox(64, "Search", "Finished!")

Exit

Heed help, cheers!!!

Posted

And your question is?

My UDFs and Tutorials:

Spoiler

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

 

Posted

Check functions ProgressSet, ProgressOn and ProgressOff in the help file. The example scripts there show you what to do.

My UDFs and Tutorials:

Spoiler

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

 

Posted

Can you post the code you have (including the failing progressbar)?

My UDFs and Tutorials:

Spoiler

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

 

Posted

#include <File.au3>

$message = "Open Log file..."

$PATH = FileOpenDialog($message, @WorkingDir & "\", "Log (*.log)", 1 + 4 )
If @error Then Exit

$search = InputBox("Search", "What to serch for", "")

$Form          =  GUICreate("GUI",450,200)
$progressbar    =  GUICtrlCreateProgress(10, 150, 430, 20)
GUISetState(@SW_SHOW)

$FILE = FileOpen($PATH, 0)
For $INDEX = 1 To _FileCountLines($PATH)
    $LINE = FileReadLine($FILE,$INDEX)
    $FIND = StringInStr($LINE,$search)
    If Not @error And $FIND <> 0 Then MsgBox(48,"Found!",$LINE)
    GUICtrlSetData($progressbar,$INDEX)
Next
FileClose($FILE)

MsgBox(64, "Search", "Finished!")

Exit

I know this is wrong so i didn't publish it at the first place...

Posted

You have to specify percent so the script should look like:

#include <File.au3>

$message = "Open Log file..."

$PATH = FileOpenDialog($message, @WorkingDir & "", "Log (*.log)", 1 + 4)
If @error Then Exit

$search = InputBox("Search", "What to serch for", "")

$Form = GUICreate("GUI", 450, 200)
$progressbar = GUICtrlCreateProgress(10, 150, 430, 20)
GUISetState(@SW_SHOW)

$FILE = FileOpen($PATH, 0)
$iRecords = _FileCountLines($PATH)
For $INDEX = 1 To $iRecords
    $LINE = FileReadLine($FILE, $INDEX)
    $FIND = StringInStr($LINE, $search)
    If Not @error And $FIND <> 0 Then MsgBox(48, "Found!", $LINE)
    GUICtrlSetData($progressbar, Int($iRecords * 100 / $INDEX))
Next
FileClose($FILE)

MsgBox(64, "Search", "Finished!")

Exit

My UDFs and Tutorials:

Spoiler

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

 

Posted (edited)

With all due respect, this not working :

Progress bar went from 0-100% less than a second..

This app need to work on xp intel celeron 2.4ghz

Edited by tempman
Posted

I see. But this works - tested ;)

#include <File.au3>

$message = "Open Log file..."

$PATH = FileOpenDialog($message, @WorkingDir & "", "Log (*.log)", 1 + 4)
If @error Then Exit

$search = InputBox("Search", "What to serch for", "")

ProgressOn("Searching Log Files", "Log File: " & $PATH)
$FILE = FileOpen($PATH, 0)
$iRecords = _FileCountLines($PATH)
For $INDEX = 1 To $iRecords
    $LINE = FileReadLine($FILE, $INDEX)
    $FIND = StringInStr($LINE, $search)
    If Not @error And $FIND <> 0 Then MsgBox(48, "Found!", $LINE)
    $percent = Int(($INDEX * 100) / $iRecords)
    ProgressSet($percent, $percent & "%")
Next
ProgressOff()
FileClose($FILE)

MsgBox(64, "Search", "Finished!")

Exit

My UDFs and Tutorials:

Spoiler

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

 

Posted

Yes, thank you for this, but Progress bar is always on top, so when message box appears it is behind Progress bar.

Can that be fixed?

Cheers!

Posted

Sure:

#include <File.au3>

$message = "Open Log file..."

$PATH = FileOpenDialog($message, @WorkingDir & "", "Log (*.log)", 1 + 4)
If @error Then Exit

$search = InputBox("Search", "What to serch for", "")

ProgressOn("Searching Log Files", "Log File: " & $PATH, "", default, (@DesktopHeight/2)-250, 2)
$FILE = FileOpen($PATH, 0)
$iRecords = _FileCountLines($PATH)
For $INDEX = 1 To $iRecords
    $LINE = FileReadLine($FILE, $INDEX)
    $FIND = StringInStr($LINE, $search)
    If Not @error And $FIND <> 0 Then MsgBox(48, "Found!", $LINE)
    $percent = Int(($INDEX * 100) / $iRecords)
    ProgressSet($percent, $percent & "%")
Next
ProgressOff()
FileClose($FILE)

MsgBox(64, "Search", "Finished!")

Exit

My UDFs and Tutorials:

Spoiler

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

 

Posted (edited)

Cheers mate!!!

I find also this:

262144 MsgBox has top-most attribute set 0x40000

so if this:

If Not @error And $FIND <> 0 Then MsgBox(48, "Found!", $LINE)

change to this:

If Not @error And $FIND <> 0 Then MsgBox(262144, "Found!", $LINE)

problem is also solved!

Thank you for your time...

Edited by tempman
Posted
:D

My UDFs and Tutorials:

Spoiler

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

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...