Sign in to follow this  
Followers 0
MvGulik

[Solved] semi background processing?

3 posts in this topic

#1 ·  Posted (edited)

Any tips (or forum links) on altenitives for doing some current script related tasks while also waiting for gui messages.

The specific task in my case is content(hasing:CRC,MD5,...) scanning of files.

With the need for some intermediate feedback and control possibilities over the task.

Using GUIOnEvent mode is this case the lasts desired option.

And real multi.task ? treading is way past my skills.

currently using this kind of basic test setup. (just for getting the background task up and running properly)

Opt('GUIOnEventMode', 0)
; ...
Func GuiWait()
    Do
    ; ... some GUI related checks.
    ; ... IF "background task" THEN ...
        ; ... "check background task status"
        ; ... IF "new file to scan" THEN ... "update_task"
        ; ... IF "GUI update needed" THEN ... "update_gui"
    ; ... ELSEIF "any new file to scan" THEN ... "start_task"
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc

It works but is inefficient(overall speed) because of GUIGetMsg() designed autosleep behavior.

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites



Any tips (or forum links) on altenitives for doing some current script related tasks while also waiting for gui messages.

The specific task in my case is content(hasing:CRC,MD5,...) scanning of files.

With the need for some intermediate feedback and control possibilities over the task.

Using GUIOnEvent mode is this case the lasts desired option.

And real multi.task ? treading is way past my skills.

currently using this kind of basic test setup. (just for getting the background task up and running properly)

Opt('GUIOnEventMode', 0)
; ...
Func GuiWait()
    Do
    ; ... some GUI related checks.
    ; ... IF "background task" THEN ...
        ; ... "check background task status"
        ; ... IF "new file to scan" THEN ... "update_task"
        ; ... IF "GUI update needed" THEN ... "update_gui"
    ; ... ELSEIF "any new file to scan" THEN ... "start_task"
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc

It works but is inefficient because of GUIGetMsg() designed autosleep behavior.

Why don't you want to use OnEvent mode? That would be the easiest and most efficient I would expect.

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

#3 ·  Posted (edited)

Utilizing Multi-processes in AutoIt might help... I don't fully recommend this as a solution, but it would be alright for any personal project.

If $CmdLine[0] > 0 Then
    If $CmdLine[1] = "CRC" Then
        MsgBox(0,"CRC","CRC Check code here")
        Exit
    EndIf
EndIf
While 1
    ;Doing GUI Stuff here...
    If $Var = "CRC Check" Then
        ShellExecute(@ScriptFullPath,"CRC")
    EndIf
WEnd

Oh, and keep in kind that logically, the variables used in forked processes don't tie in to the initial program. You must also compile the program to see results. This works in both CLI and GUI compiles. :)

Edited by BinaryBrother

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