Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    pc117's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Malaysia,Kuala Lumpur
    Posts
    222
    Reputation
    10
    Thanks
    1,853
    My Mood
    Sick

    MAT Automation Unblock Script

    My Unblock scrpits

    want to make themselves understood



    #
    # Simple example which uses a pool of workers to carry out some tasks.
    #
    # Notice that the results will probably not come out of the output
    # queue in the same in the same order as the corresponding tasks were
    # put on the input queue. If it is important to get the results back
    # in the original order then consider using `Pool.map()` or
    # `Pool.imap()` (which will save on the amount of code needed anyway).
    #
    # Copyright (c) 2006-2008, R Oudkerk
    # All rights reserved.
    #

    import time
    import random

    from multiprocessing import Process, Queue, current_process, freeze_support

    #
    # Function run by worker processes
    #

    def worker(input, output):
    for func, args in iter(input.get, 'STOP'):
    result = calculate(func, args)
    output.put(result)

    #
    # Function used to calculate result
    #

    def calculate(func, args):
    result = func(*args)
    return '%s says that %s%s = %s' % \
    (current_process().name, func.__name__, args, result)

    #
    # Functions referenced by tasks
    #

    def mul(a, b):
    time.sleep(0.5*random.random())
    return a * b

    def plus(a, b):
    time.sleep(0.5*random.random())
    return a + b

    #
    #
    #

    def test():
    NUMBER_OF_PROCESSES = 4
    TASKS1 = [(mul, (i, 7)) for i in range(20)]
    TASKS2 = [(plus, (i, 8)) for i in range(10)]

    # Create queues
    task_queue = Queue()
    done_queue = Queue()

    # Submit tasks
    for task in TASKS1:
    task_queue.put(task)

    # Start worker processes
    for i in range(NUMBER_OF_PROCESSES):
    Process(target=worker, args=(task_queue, done_queue)).start()

    # Get and print results
    print('Unordered results:')
    for i in range(len(TASKS1)):
    print('\t', done_queue.get())

    # Add more tasks using `put()`
    for task in TASKS2:
    task_queue.put(task)

    # Get and print some more results
    for i in range(len(TASKS2)):
    print('\t', done_queue.get())

    # Tell child processes to stop
    for i in range(NUMBER_OF_PROCESSES):
    task_queue.put('STOP')

    if __name__ == '__main__':
    freeze_support()
    test()

  2. #2
    Wahan10's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    3
    My Mood
    Amazed
    Wtf? So... what do you wanna reach with this?!
    Yeah... uhmm.... think about it

  3. #3
    UNKNOWN.SURVIVOR's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    hey how do you put that source code into scripts?

  4. #4
    pc117's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Malaysia,Kuala Lumpur
    Posts
    222
    Reputation
    10
    Thanks
    1,853
    My Mood
    Sick
    I've the source code itself, but you have to do just create a file unblock-scripts.atpy

  5. #5
    Lee Jun Ying's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    7
    My Mood
    Tired
    create at where??
    Last edited by Lee Jun Ying; 02-21-2012 at 02:35 AM.

  6. #6
    pc117's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Malaysia,Kuala Lumpur
    Posts
    222
    Reputation
    10
    Thanks
    1,853
    My Mood
    Sick
    pless create for .atpy and save to scripts

  7. #7
    Lee Jun Ying's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    7
    My Mood
    Tired
    cannot work
    Last edited by Lee Jun Ying; 02-21-2012 at 03:48 AM.

  8. #8
    jaykay's Avatar
    Join Date
    Apr 2008
    Gender
    male
    Posts
    118
    Reputation
    10
    Thanks
    3
    My Mood
    In Love
    It work? or Not work?

  9. #9
    pc117's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Malaysia,Kuala Lumpur
    Posts
    222
    Reputation
    10
    Thanks
    1,853
    My Mood
    Sick
    Work For Suba Xshot Cib

  10. #10
    tHeDoCtOr46's Avatar
    Join Date
    Jun 2011
    Gender
    female
    Location
    ƈἶէყ օբ հმƈƙεɾ
    Posts
    716
    Reputation
    15
    Thanks
    106
    My Mood
    In Love
    Good Job...



  11. #11
    pc117's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Malaysia,Kuala Lumpur
    Posts
    222
    Reputation
    10
    Thanks
    1,853
    My Mood
    Sick
    TQ MY MOOD GOOD NOW .........

  12. #12
    adibmokhali's Avatar
    Join Date
    Jan 2012
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    0
    My Mood
    Happy
    how la

    how to create atpy file

  13. #13
    suhailxmaster's Avatar
    Join Date
    Jan 2012
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    0
    what's the code have to copy,is it this=


    #
    # Simple example which uses a pool of workers to carry out some tasks.
    #
    # Notice that the results will probably not come out of the output
    # queue in the same in the same order as the corresponding tasks were
    # put on the input queue. If it is important to get the results back
    # in the original order then consider using `Pool.map()` or
    # `Pool.imap()` (which will save on the amount of code needed anyway).
    #
    # Copyright (c) 2006-2008, R Oudkerk
    # All rights reserved.
    #

    import time
    import random

    from multiprocessing import Process, Queue, current_process, freeze_support

    #
    # Function run by worker processes
    #

    def worker(input, output):
    for func, args in iter(input.get, 'STOP'):
    result = calculate(func, args)
    output.put(result)

    #
    # Function used to calculate result
    #

    def calculate(func, args):
    result = func(*args)
    return '%s says that %s%s = %s' % \
    (current_process().name, func.__name__, args, result)

    #
    # Functions referenced by tasks
    #

    def mul(a, b):
    time.sleep(0.5*random.random())
    return a * b

    def plus(a, b):
    time.sleep(0.5*random.random())
    return a + b

    #
    #
    #

    def test():
    NUMBER_OF_PROCESSES = 4
    TASKS1 = [(mul, (i, 7)) for i in range(20)]
    TASKS2 = [(plus, (i, 8)) for i in range(10)]

    # Create queues
    task_queue = Queue()
    done_queue = Queue()

    # Submit tasks
    for task in TASKS1:
    task_queue.put(task)

    # Start worker processes
    for i in range(NUMBER_OF_PROCESSES):
    Process(target=worker, args=(task_queue, done_queue)).start()

    # Get and print results
    print('Unordered results:')
    for i in range(len(TASKS1)):
    print('\t', done_queue.get())

    # Add more tasks using `put()`
    for task in TASKS2:
    task_queue.put(task)

    # Get and print some more results
    for i in range(len(TASKS2)):
    print('\t', done_queue.get())

    # Tell child processes to stop
    for i in range(NUMBER_OF_PROCESSES):
    task_queue.put('STOP')

    if __name__ == '__main__':
    freeze_support()
    test()

  14. #14
    pc117's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Malaysia,Kuala Lumpur
    Posts
    222
    Reputation
    10
    Thanks
    1,853
    My Mood
    Sick
    seee the matautotion.bin show the script

  15. #15
    kea1111's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    32
    Reputation
    10
    Thanks
    5
    My Mood
    Confused
    Sorry.I don't understand this. Can u plz make a simple video tutorial on Youtube?

Page 1 of 2 12 LastLast

Similar Threads

  1. [Tutorial] i know how to use MAT automation
    By asdfg119714 in forum Mission Against Terror Discussions
    Replies: 0
    Last Post: 02-15-2011, 01:34 AM
  2. MAT Automaton new script help
    By DarkLaw587 in forum Mission Against Terror Discussions
    Replies: 2
    Last Post: 02-11-2011, 10:59 AM
  3. [Help] MAT automation help :O PLZ
    By alextour10 in forum Mission Against Terror Discussions
    Replies: 11
    Last Post: 02-09-2011, 10:24 PM
  4. MAT automation
    By bigiemac in forum Mission Against Terror Discussions
    Replies: 3
    Last Post: 02-06-2011, 09:06 PM
  5. How to edit the MAT Automation Script Using Python
    By helmage2 in forum Mission Against Terror Discussions
    Replies: 0
    Last Post: 02-02-2011, 07:36 AM