NewUser12

AdlibRegister including Sleep

28 posts in this topic

#1 ·  Posted

Hi , is there a way to make sleep in adlibregister function but without pausing the script ?

when using something like this only 123 gonna be displayed ...

 

AdlibRegister("Check",500)

Func check()
    ConsoleWrite("1")
    Sleep(500)
    ConsoleWrite("2")
    Sleep(500)
    ConsoleWrite("3")
    Sleep(500)
EndFunc

while 1
    Sleep(500)
    ConsoleWrite("NOT")
WEnd


I wish if u understand me and thanks :)

Share this post


Link to post
Share on other sites



#2 ·  Posted

11 minutes ago, NewUser12 said:

Hi , is there a way to make sleep in adlibregister function but without pausing the script ?

Not in the same script as it is a single thread. This would require a seconds instance of the script.

Jos


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

#3 ·  Posted

Sorry but i didn't get what u mean :(

Share this post


Link to post
Share on other sites

#5 ·  Posted

The second part

Share this post


Link to post
Share on other sites

#6 ·  Posted

So when you want to have a specific function running in parallel with you main function, your only option is to shell a second script and communicate with it via a form of messaging to make it do what it needs to do. There are examples enough how this can be done.

Search for WM_COPYDATA to find examples.

Jos


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

#7 ·  Posted

Well i see that autoit doesn't support that right ?
Also i wanted to ask another question iam getting from ini files likes 5k lines and i have an progressbar is there a way to make the progressbar works in background while the listview is getting information from the ini files and both ends together ?

Share this post


Link to post
Share on other sites

#8 ·  Posted

Not sure I understand the question: Isn't this simply a matter of updating the processbar in the part that populates the listview?

Jos


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

#9 ·  Posted

Iam getting informations like this :
 

Func _Load()
$readsectionnames = _IniReadSectionNamesEx("file.txt")

GUICtrlSetData($Labelofloading,"1 %")
For $i = 1 to $readsectionnames[0]
 _GUICtrlListView_AddItem($ListView1,$readsectionnames[$i])
Next

For $i = 1 to 20
    Sleep(100)
GUICtrlSetData($Labelofloading,$i&" %")
Next

For $i = 1 to $readsectionnames[0]
$Case = IniRead("file.txt",$readsectionnames[$i],"Case","")
_GUICtrlListView_AddSubItem($ListView1,$i,$Case,1,1)
Next

For $i = 21 to 40
    Sleep(100)
GUICtrlSetData($Labelofloading,$i&" %")
Next

For $i = 1 to $readsectionnames[0]
$Code = iniread("file.txt",$readsectionnames[$i],"Code","")
_GUICtrlListView_AddSubItem($ListView1,$i,$Code,2,2)
Next

For $i = 41 to 50
    Sleep(100)
GUICtrlSetData($Labelofloading,$i&" %")
Next

For $i = 1 to $readsectionnames[0]
$Dateofbuying = iniread("file.txt",$readsectionnames[$i],"Date of buying","")
_GUICtrlListView_AddSubItem($ListView1,$i,$Dateofbuying,3,3)
Next

;;etc
endfunc

but actually i didn't like the fake progressbar for example like the $labelofloading i did i wanted it to work in background idk how xd

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Can't you simply start a progressbar and update the with each loop and use a single loop?
Something like this: (Untested)

Func _Load()
    ; Display a progress bar window.
    ProgressOn("Loading Progress", "getting data", "0%")
    ; Set the "subtext" and "maintext" of the progress bar window.
    $readsectionnames = _IniReadSectionNamesEx("file.txt")
    
    GUICtrlSetData($Labelofloading, "1 %")
    For $i = 1 To $readsectionnames[0]
        ProgressSet($i*100/$readsectionnames[0], $i & "%")
        _GUICtrlListView_AddItem($ListView1, $readsectionnames[$i])
        Sleep(100)
        GUICtrlSetData($Labelofloading, $i & " %")
        $Case = IniRead("file.txt", $readsectionnames[$i], "Case", "")
        _GUICtrlListView_AddSubItem($ListView1, $i, $Case, 1, 1)
        Sleep(100)
        GUICtrlSetData($Labelofloading, $i & " %")
        $Code = IniRead("file.txt", $readsectionnames[$i], "Code", "")
        _GUICtrlListView_AddSubItem($ListView1, $i, $Code, 2, 2)
        Sleep(100)
        GUICtrlSetData($Labelofloading, $i & " %")
        $Dateofbuying = IniRead("file.txt", $readsectionnames[$i], "Date of buying", "")
        _GUICtrlListView_AddSubItem($ListView1, $i, $Dateofbuying, 3, 3)
    Next
    ProgressOff()

    ;;etc
EndFunc   ;==>_Load

 

Edited by Jos
fixed typo
1 person likes this

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

#11 ·  Posted

3 minutes ago, Jos said:

Can't you simply start a progressbar and update the with each loop and use a single loop?
Something like this: (Untested)

Func _Load()
    ; Display a progress bar window.
    ProgressOn("Loading Progress", "getting data", "0%")
    ; Set the "subtext" and "maintext" of the progress bar window.
    $readsectionnames = _IniReadSectionNamesEx("file.txt")
    
    GUICtrlSetData($Labelofloading, "1 %")
    For $i = 1 To $readsectionnames[0]
        ProgressSet($i+100/$readsectionnames[0], $i & "%")
        _GUICtrlListView_AddItem($ListView1, $readsectionnames[$i])
        Sleep(100)
        GUICtrlSetData($Labelofloading, $i & " %")
        $Case = IniRead("file.txt", $readsectionnames[$i], "Case", "")
        _GUICtrlListView_AddSubItem($ListView1, $i, $Case, 1, 1)
        Sleep(100)
        GUICtrlSetData($Labelofloading, $i & " %")
        $Code = IniRead("file.txt", $readsectionnames[$i], "Code", "")
        _GUICtrlListView_AddSubItem($ListView1, $i, $Code, 2, 2)
        Sleep(100)
        GUICtrlSetData($Labelofloading, $i & " %")
        $Dateofbuying = IniRead("file.txt", $readsectionnames[$i], "Date of buying", "")
        _GUICtrlListView_AddSubItem($ListView1, $i, $Dateofbuying, 3, 3)
    Next
    ProgressOff()

    ;;etc
EndFunc   ;==>_Load

 

Good example for me. Thank you

Share this post


Link to post
Share on other sites

#13 ·  Posted

Thanks for the example bro <3

Sorry this is my last question hahaha 
How to learn all the syntax in autoit ? what's the best way.

Share this post


Link to post
Share on other sites

#14 ·  Posted

3 minutes ago, NewUser12 said:

Sorry this is my last question hahaha 

Somehow doubt that ... and there is no issue to ask questions.

3 minutes ago, NewUser12 said:

How to learn all the syntax in autoit ? what's the best way.

  1. F1 /Search
  2. Read
  3. Think
  4. Try
  5. Goto 1

Jos :)

 

1 person likes this

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

#15 ·  Posted

That's how you learned ?
Also it's important to have another programming language like C++ beside autoit ?

Share this post


Link to post
Share on other sites

#16 ·  Posted

Also is there a way to check if the taskbar is using small icons or large icons ? just to set the gui full screen 

Share this post


Link to post
Share on other sites

#17 ·  Posted

Yes, that is how I learned this language back in 2004 (i think), but have been programming since 1978 in various languages of which one is Basic, which is somewhat similar to AutoIt3.
To me learning any language is initially investing in learning the words (Functions etc)  and grammar (Syntax) and then putting them together into sentences (Scripts). 
I do realize it isn't always easy for everybody to have the discipline and patience, but to me it's the only way to properly learn.

As to your last post (to make a link to the first part of this PM): did you try to goggle it? One of the first hits I got was this one
It is in general fair to assume you aren't the first one asking the questions and likely somebody already shared the answer somewhere on the internet so always try and search for the answer yourself. ;)

Jos

1 person likes this

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

#18 ·  Posted

I searched a lot for that the sizes that in the registry files doesn't work correctly and it just changes when restarting pc so i would like to ask if there's another way to - minus the desktopheight from the taskbar size to get the gui full screen resolution

Share this post


Link to post
Share on other sites

#20 ·  Posted

This is the icon of desktop not the taskbar right ?

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