Home Tasker The Minimal & Elegant giveaway WINNERS

The Minimal & Elegant giveaway WINNERS

Picking the winners live! Livestream and making a Tasker Winners project!

Hey, folks.

If you missed my 1st live stream you can watch the entire thing in this link. It takes you through the process of creating a task to select the 20 winners at random. The process was messy and flawed with usual tasker problems but viewers claimed I was entertaining at times. This also shows you how much time sometimes you have to spend to figure something out. If it was an already made tutorial it would take me about 3-4min after the edit. I wanted to be unprepared. Thanks, all of you guys for coming and helping me out with all the issues.

If you curious how the task works here is the rundown. I want to get all the people in one list, then use random action, to pick a random number which will correspond to the array element. In addition to that, I want the array to be shuffled to give extreme positions (end.start) better chances as well. Each time a winner is picked, a code is emailed, and the winner is removed from the list.

Rinse and repeat 20 times

Livestream 1:28:00 is where the task runs and picks the winners.

Data processing

The form with your submissions contains the name, email address and newsletter option. We obviously don’t need the last one. As we are going to shuffle the array elements we have to merge the name and email address together.

I will have 3 actions to create relevant arrays and one loop to create a list to contain the name,address array.

A thing I struggled for a while was splitting the names by ENTER. The way to go is to create a variable %Enter and set it to ENTER. Then simply split by this variable. The actions A1-A7 create 3 arrays containing: name, address, code.

We need a FOR loop to assign a %Result – an array that will store the name,address. For each element of array with the name %WinName we will set a variable %WinName(%count),%WinEmail(%count). Each time the loop is performed %count will increase by 1 until we have no more names left.

Profile Description
AllPeople (30)
	A1: Variable Set [ Name:%Enter To:
 Recurse Variables:Off Do Maths:Off Append:Off ] 
	A2: Variable Set [ Name:%WinName To: Recurse Variables:Off Do Maths:Off Append:Off ] 
	A3: Variable Set [ Name:%WinEmail To:
 Recurse Variables:Off Do Maths:Off Append:Off ] 
	A4: Variable Set [ Name:%Codes To:
 Recurse Variables:Off Do Maths:Off Append:Off ] 
	A5: Variable Split [ Name:%Codes Splitter:%Enter Delete Base:On ] 
	A6: Variable Split [ Name:%WinEmail Splitter:%Enter Delete Base:On ] 
	A7: Variable Split [ Name:%WinName Splitter:%Enter Delete Base:On ] 
	A8: Variable Set [ Name:%count To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
	A9: For [ Variable:%Result Items:%WinName() ] 
	A10: Variable Set [ Name:%joined To:%WinName(%count),%WinEmail(%count)
            Recurse Variables:Off Do Maths:Off Append:Off ] 
	A11: Array Push [ Variable Array:%ReadyList Position:1 Value:%joined Fill Spaces:On ] 
	A12: Variable Add [ Name:%count Value:1 Wrap Around:0 ] 
	A13: End For 

Email and Code task

Our %Codes array contains 20 entries. Each time a winner is picked we want to take one code and enter it in an email. Because this task will be run by a Perform Task action, we will have 2 variables %par1 and %par2 available. One will contain an email and one the name of the person. When an email is composed, it also uses a %winnercode from the Array Pop action to assign a winning code. Then AutoInput sends the email for us. As you could see in the stream I had an issue with it as streaming screen on my PC caused issues with the AI.

Profile Description
Codes (32)
	A1: Array Pop [ Variable Array:%Codes Position:1 To Var:%winnercode ] 
	A2: Compose Email [ Recipient(s):%par2 
            Subject:Congratulations! You won! Message:Hello %par1

You have won a code for the Minimal & Elegant watch face. Here is the code:

%winnercode

Please claim the code before 30th April.

Thank you and see you around soon. ] 
	A3: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] 
	A4: AutoInput Action [ Configuration:Type: Text
Value: Send
Action : Click Timeout (Seconds):20 ] 
	A5: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] 

Picking the winners

We have a list of people, and we want the task to run 20 times. I will set up a simple timer %count20 in conjunction with  GOTO action using labels. Variable %ReadyList(#) gives us a current number of people in the array, each time we pick one winner, we have to make sure this list is updated (array pop)  mixed (array process) and the winner is picked at random (Variable randomise). When the winning entry is picked, it is split into 2, %WinnersNamEm(1) and %WinnersNamEm(1) – then these values are used in Perform Task as %par1 and %par2. Each time the winner is picked, the Email and Code task is executed.

Profile Description
Pick a winner (31)
	A1: Variable Set [ Name:%count20 To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
	
	A2: Variable Set [ Name:%NumberOfPpl To:%ReadyList(#) 
            Recurse Variables:Off Do Maths:Off Append:Off ] 
	A3: Variable Randomize [ Name:%AWinner Min:1 Max:%NumberOfPpl ] 
	A4: Array Pop [ Variable Array:%ReadyList Position:%AWinner To Var:%WinnersNamEm ] 
	A5: Array Process [ Variable Array:%ReadyList Type:Shuffle ] 
	A6: Variable Split [ Name:%WinnersNamEm Splitter:, Delete Base:On ] 
	A7: Perform Task [ Name:Codes Priority:%priority 
            Parameter 1 (%par1):%WinnersNamEm(1) Parameter 2 (%par2):%WinnersNamEm(2) 
            Return Value Variable: Stop:Off ] 
	A8: Variable Add [ Name:%count20 Value:1 Wrap Around:0 ] 
	A9: Goto [ Type:Action Label Number:1 Label:starthere ] If [ %count20 < 21 ]

The winners:

Thank you all for participating, all winners have been emailed. Congratulations to:

  1. James Barnes
  2. Parth Temkar
  3. Bryce
  4. Sarah Whitekiller
  5. Aatif
  6. Adam
  7. Mihir Gohad
  8. Jason Bishop
  9. JimDijkstra86NL
  10. Stephen Gower
  11. Michael Epiney
  12. Eric
  13. Justin Somermeyer
  14. Mark Roedel
  15. Kevin
  16. Sebastian
  17. David
  18. Thomas
  19. Siddharth
  20. Dennis

I will try to organise another giveaway soon, so keep in touch!

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated in style with crypto-currency

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

0
To server or not to server? That's a very silly question!

Best Automation Projects

ESP8266 WIFI lights under $5

0
Your Sonoff device can't do this!

Free wireless doorbell (Amazon Dash button hack)

0
The most terrifying situation I can imagine* is missing a parcel

New Amazon Dash Buttons

0
You can teach new buttons old tricks!

ESP8266 ceiling light – demo

0
Testing the ESP8266 as a WIFI light controller

Try Tasker and Raspberry Pi for your home automation needs!

0
Raspberry Pi can help you with your Tasker profiles

Smart Home

Best USB-C hack ever!

0
How to add USB-C charging to your old laptop without ruining it. USB-C hack for Lenovo Yoga

Sonoff Micro PLUS (USB-C hardware mod)

0
Sonoff Micro PLUS is a small modification that adds an USB-C port to Sonoff Micro - to make it even more useful!

Nora – Google Assistant in NodeRED

0
Integrate Google Assistant with NodeRED thanks to Nora - NodeRED home automation

“Inching” like a PRO (nodeRED edition)

0
Learn how to add inching to anything in NodeRED

Smart overnight charging with Tasker

0
Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile