Jump to content
Sign in to follow this  
Crome_BAD

Multi Task?

Recommended Posts

Crome_BAD

I was just wondering is AutoIt 3 can multi task, do 2 operations at once, WITHOUT makin 2 programs, my other system program i made i have 5 programs running, it was insane to do, i was wondering if there was a way to multi task.

Peace

Crome_BAD

Share this post


Link to post
Share on other sites
SlimShady

Can't you put the tasks in seperate functions and call them one at a time?

Wait... I see your problem. When a task is run and it waits for something the script won't continue in the mean time.

Edited by SlimShady

Share this post


Link to post
Share on other sites
t0ddie

i know of only one way.

thats the hotkeyset function.

it waits for an event.. (you pressing a key)

while other functions are being carried out.

other than that, it would be nice to have some sort of loop doing something while other functions are being carried out. (something automatic, without user intervention like hotkeyset)

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites
SlimShady

I understand him. The tasks don't have to run in a loop.

The only solution I can think of are seperate scripts.

Share this post


Link to post
Share on other sites
Crome_BAD

Hmmm Ok, ya i kno the hotkeyset, ill havta expirament, now another question....lol. Im FUll Of Them:P. Is There a way to center a GUI, or is that the default GUICreate( "Info", 500, 500, -1, -1) ?

Share this post


Link to post
Share on other sites
t0ddie

I understand him. The tasks don't have to run in a loop.

The only solution I can think of are seperate scripts.

<{POST_SNAPBACK}>

isnt hotkeyset a loop? constantly checking to see if a key was pressed?

it would be nice to have a function like hotkeyset, that would do something

WHILE another function was executing.

instead of waiting for a key to be pressed,

wait for some event that the script can detect, itstead of relying on user intervention (pressing a key)

checking this, while other parts of the script continue to execute. instead of waiting for the event, and doing nothing until it occurs.

i mean, its doable with seperate scripts. but that makes things messy

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites
Crome_BAD

I agree, i posted sum files i was working with on my public space, i had to make 5 seperate programs to do the actual stuff of 1, it was very messy. I kno the hotkeyset would do it, maybe you could define two to run at once?

Just a thought, still sorta new at this....

Crome_BAD

Share this post


Link to post
Share on other sites
Crome_BAD

Is that a User Defined function, im sorry, i dont know that much about it, is there a post on how to set them up or use them? Thank You For All The Help Guys!!

Crome_BAD

Share this post


Link to post
Share on other sites
Jos

Is that a User Defined function, im sorry, i dont know that much about it, is there a post on how to set them up or use them? Thank You For All The Help Guys!!

Crome_BAD

<{POST_SNAPBACK}>

No, its a build in function that:

Every 250 ms (or time ms) the specified "function" is called--typically to check for unforeseen errors. For example, you could use adlib in a script which causes an error window to pop up unpredictably.

The adlib function should be kept simple as it is executed often and during this time the main script is paused. Also, the time parameter should be used carefully to avoid CPU load.

Check out the helpfile for an example. :idiot:

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
Crome_BAD

Hmmm never saw it, ok thank you for the help, ill take a look at it and see if i can do anything.

Peace,

Crome_BAD

I could do this....

#include <GUICONSTANTS.AU3>

; -----HotKeySet-----

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

$hotkey1 = HotKeySet( "!1", "ShowIP")

$ctrlkey1 = HotKeySet( "^1", "ClearIP")

; -----Globals------

Global $ip = @IPAddress1

; -----Main GUI------

$window = GUICreate( "Windows System Information", 250, 250, 0, 0)

GUISetBkColor( 0x000000)

; -----Lables, Lists, ETC.------

; -----GUI State-------

GUISetState(@SW_SHOW)

Do

Sleep(50)

Until 1 = 2

Func ShowIP()

Global $iplabel = GUICtrlCreateLabel( "IP Address:" & $ip, 5, 25, $SS_SUNKEN)

GUICtrlSetColor( $iplabel, 0xffffff)

EndFunc

Func ClearIP()

GUICtrlSetData( $iplabel, "")

GUICtrlSetBkColor( $iplabel, 0x000000)

EndFunc

Func Stop()

Exit

EndFunc

Edited by Crome_BAD

Share this post


Link to post
Share on other sites
t0ddie

ahh, so the main script IS paused during adlib execution.

better than nothing i suppose. its OLMOST like 2 things running at the same time.

but the more you put into adlib, the more you will load the cpu.

thats not desirable.

just my 2 cents

EDIT:to bad there isnt something like

call ("function1") AND call ("function2") AND call ("function3") AND get me a beer.

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites
Crome_BAD

Lol, im slowly wokrin with that code. Ill post it as i go, right now i can get it to show time constantly, ima try to keep my Do $time, and when i press a key, ill see if it will Do $time again in a diferent label.

EDIT: Eh it dont work, crap, hmmm scratch that idea O_O

Edited by Crome_BAD

Share this post


Link to post
Share on other sites
Crome_BAD

Maybe This WIll Help, Im going to make a help file that opens when the main file opens to show the commands....

#include <GUICONSTANTS.AU3>

; -----HotKeySet-----

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

$hotkey1 = HotKeySet( "!1", "ShowIP")
$hotkey2 = HotKeySet( "!2", "Mem")

$ctrlkey1 = HotKeySet( "^1", "ClearIp")
$ctrlkey1 = HotKeySet( "^2", "ClearMem")

; -----Globals------

Global $ip = @IPAddress1
Global $mem = MemGetStats()

; -----Figures-------

$aram = ($mem[1] / 2)

; -----Main GUI------

$window = GUICreate( "Windows System Information", 250, 250, 0, 0)

GUISetBkColor( 0x000000)

; -----Lables, Lists, ETC.------

$timelabel = GUICtrlCreateLabel( "Time On This Computer:", 80, 235)

; -----Colors------

GUICtrlSetColor( $timelabel, 0xffffff)

; -----GUI State-------

GUISetState(@SW_SHOW)

Do
   Sleep(950)
   
   $time = @HOUR & ":" & @MIN & ":" & @SEC
   
   $timel = GUICtrlCreateLabel( $time, 200, 230, -1, -1, $SS_SUNKEN, $WS_EX_CLIENTEDGE)
   GUICtrlSetColor( $timel, 0xffffff)
   
Until 1 = 2


Func ShowIP()
   
      Global $iplabel = GUICtrlCreateLabel( "IP Address:" & $ip, 5, 25)
      GUICtrlSetColor( $iplabel, 0xffffff)
      
   EndFunc
   
Func ClearIP()
   
      GUICtrlSetData( $iplabel, "")
      GUICtrlSetColor( $iplabel, 0x000000)
      
   EndFunc
   
Func Mem()
   
      Global $memstats = GUICtrlCreateLabel( "Available Ram:", 5, 45)
      GUICtrlSetColor( $memstats, 0xffffff)
      If $aram > $mem[2] Then
         Global $availram = GUICtrlCreateLabel( ($mem[2] / 1000), 100, 45)
         GUICtrlSetColor( $availram, 0xff0000)
      Else
         Global $availram = GUICtrlCreateLabel( ($mem[2] / 1000), 100, 45)
         GUICtrlSetColor( $availram, 0xffffff)
      EndIf
      
   EndFunc
   
Func ClearMem()
   
      GUICtrlSetData( $memstats, "")
      GUICtrlSetData( $availram, "")
      GUICtrlSetColor( $memstats, 0x000000)
      GUICtrlSetColor( $availram, 0x000000)
      
      
   EndFunc
   
Func Stop()
   
      Exit
      
EndFunc

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.