Sign in to follow this  
Followers 0
Necromorph

infinite loop

21 posts in this topic

i want to make this an infinite loop func so i can call it later, but im not sure how to do it.

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

    GUICreate("COPYING INSTALLER", 300, 75) 
    GUICTRLCREATELABEL("Copying Latest Installer", 25, 50)
    $prog = GUICtrlCreateProgress(25, 25, 250, 20, $PBS_MARQUEE)
    
DO
    GUICTRLSendMsg($prog, $PBM_SETMARQUEE, True, 25)
    GUISetState()
UNTIL

THANKS

Share this post


Link to post
Share on other sites



redLabel,

Does this help? :mellow:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

HotKeySet("{ESC}", "Stop_Progress")

GUICreate("COPYING INSTALLER", 300, 75)
GUICtrlCreateLabel("Copying Latest Installer", 25, 50)
$prog = GUICtrlCreateProgress(25, 25, 250, 20, $PBS_MARQUEE)
GUISetState()
; Set flag and start progress
$fFlag = True
GUICTRLSendMsg($prog, $PBM_SETMARQUEE, True, 25)

Do
    Sleep(10)
Until $fFlag = False

; Stop progess
GUICTRLSendMsg($prog, $PBM_SETMARQUEE, False, 25)
$prog = GUICtrlCreateProgress(25, 25, 250, 20)

Sleep(2000)
Exit

Func Stop_Progress()
    ; Clear flag
    $fFlag = False
EndFunc

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

M23, that is bout perfect, but i'm now thinking i need a better way to do it, perhaps you can help

i want run the Marquee window while a file is copying, then once its done i just want to say GUIDELETE() and move on with my script, any ideas on how would be the best way to do so?

Share this post


Link to post
Share on other sites

redlabel,

How are you detecting the end of the file copy?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

well, that is what seems to be the problem

if i use the Marquee method, the "progress" stops while its copying, so if i start the marquee, it will go, then start the file copy, it will stop, then once the copy is done, it will continue once again

so i would like to just have the file copy trigger the marquee, and the scripts seems to "pause" while its copying, then, once finished, just delete the gui all together.

my situation is this

im copying an installer package from a local network share, and it take about ten to fifteen seconds, and i want the user to see the "something" is happening while the installer package is copying from the share to there machine. and im trying to figure out the best way to do this.

thanks for all your help.

Share this post


Link to post
Share on other sites

redLabel,

How many hints do you want! :(

Try something like this:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

$hGui = GUICreate("COPYING INSTALLER", 300, 75)
GUICtrlCreateLabel("Copying Latest Installer", 25, 50)
$prog = GUICtrlCreateProgress(25, 25, 250, 20, $PBS_MARQUEE)
GUISetState()

; Start progress
GUICTRLSendMsg($prog, $PBM_SETMARQUEE, True, 25)

; Simulate file copy
Sleep(10000)

; OK it is finished, so.....
GUIDelete($hGUI)

Next time try to think for yourself a bit more. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

that is what im saying, it doesn't keep updating the Marquee while the actual file copy is in progress, so it just "Freezes" and doesn't resume until the file copy progress is completed. in which case, no point of it at all.

so i need the file copy to run "on the side" so the Marquee keeps updating as the file is copying.

thanks for your replies and you help.

Share this post


Link to post
Share on other sites

The only other thing I can think of is a different way instead of FileCopy that does not pause the script. Maybe command line filecopy (cmd) through dos or something?


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Another option would be to create a 2nd script.

you know file size

first script calls 2nd script and starts file copy

2nd script (with hidden tray icon?) opens file progress that uses the formula

$progress=($current_size/$total_size)*100

when your progress bar reaches 100, then end the 2nd script.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

thank you you very much for your help, do you think you could maybe make me some example script,

maybe use

$dir = directory

$des = destination

just to help me understand.

but not, thank you for you help, and i will see if i can get it to work. thanks much.

Share this post


Link to post
Share on other sites

redLabel,

if i use the Marquee method, the "progress" stops while its copying

No it does not - that is the whole point of the Marquee style. Have you actually tried running the code? :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

redLabel,

No it does not - that is the whole point of the Marquee style. Have you actually tried running the code? :mellow:

M23

Why aren't you just writing the whole script and a detailed user manual to help the poor creature?

I know you can do it. :(


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

yes, it the progress stop once the file copy portion starts, after it is finished it resumes.

my code looks like this

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

$hGui = GUICreate("COPYING INSTALLER", 300, 75)
GUICtrlCreateLabel("Copying Latest Installer", 25, 50)
$prog = GUICtrlCreateProgress(25, 25, 250, 20, $PBS_MARQUEE)
GUISetState()

GUICTRLSendMsg($prog, $PBM_SETMARQUEE, True, 25)


FILECOPY("C:\DIR\TESTFOLDER\*.exe", "*.exe", 1)

GUIDelete($hGUI)

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I will try...

say file size is 1500 for example

Script 1

Run("C:\progress.exe")
FileCopy($dir,$dest)

script 2 (named progress.exe)

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
$total_size = 1500
$current_size = FileGetSize($dest)
$progress = ($current_size / $total_size) * 100

$hGUI = GUICreate("File Progress", 300, 50, -1, -1)
$prog = GUICtrlCreateProgress(3, 20, 295, 14, $PBS_SMOOTH)
$current_size = FileGetSize($dest)
$progress = ($current_size / $total_size) * 100
GUICtrlSetData($prog, $progress)
GUISetState(@SW_SHOW, $hGUI)
Do
    $current_size = FileGetSize($dest)
    $progress = ($current_size / $total_size) * 100
    GUICtrlSetData($prog, $progress)
Until $progress = 100
;or you could do Until $current_size=1500

you will have to code in your $dest, $dir variables and get the correct filesize of the original file

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

redLabel,

yes, it the progress stop once the file copy portion starts, after it is finished it resumes.

Then you have the weirdest setup I have ever seen. :mellow:

Sorry I cannot help any more.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

@ kaotkbliss

Thank you so much this is so close, but the progress bar is set to 100% right off the bat, so it is very close, but they do run at the same time. so it is very very close, i just need to refine the "progress.exe" a bit more, let me know if you have any more thoughts, thanks again.

i think what is happening is it as soon as the file copy starts it puts the total size in the dest (even thought it isn't yet) so it does the first loop, then says "its all there", so done.

Edited by redLabel

Share this post


Link to post
Share on other sites

here is a 3 line code to get an exact filesize number that autoit sees on a file. maybe your numbers are off? if the problem is what you think then maybe a small pause before the filegetsize

$input=InputBox("File","Full path and file name")
$file=FileGetSize($input)
MsgBox(0,"File Size",$file)

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

@redLabel. It looks like you have been struggling with filecopy and progress for some time, but I don't see that you have used methods that have been already developed. Did you search for solutions? Or did you not understand how to use them. This one for example looks like it should have helped.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

@martin

Thank you so much. this one works!! i did search before, but i didn't find this one, it is midly short and works, so its perfect, the only thing im having trouble with is i can't get it to work with wildcard* files, any ideas on that?

i get "unable to open 'file'", but it does find the file just fine. i use the FINDFILEFIRST method to do this

$installserver=FILEFINDFIRSTFILE("C:\test-*.exe")
$packageserver=FILEFINDNEXTFILE($installserver)
FILECLOSE($installserver)

$FileCopy = _CopyWithProgress($packageserver, "*.exe", 5120)

thanks again thought, im super close.

Edited by redLabel

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0