22 August 2018, 19:25 | #1 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
Can AmigaDOS wait for a RANDOM time?
Hi all, I'd like to create an AmigaDOS WB 3.1 batch file that does two things:
1. Waits for a random amount of time between 1 and 15 seconds 2. Then sends an HTTP post command to an internet enabled device (ping might work) Ideas? |
22 August 2018, 19:41 | #2 |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
|
22 August 2018, 19:49 | #3 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
Thanks, I know about Wait but that doesn't satisfy the random requirement.
|
22 August 2018, 19:55 | #4 |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
Why would you want to set a "random" amount of time? What is it you're trying to do exactly?
|
22 August 2018, 19:58 | #5 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
Good question. I launched a YouTube contest with The 8-Bit Guy, Jan Beta and Mindflare Retro. I want to pick the winner in a totally random and retro way. I already have the method worked out via the HTTP Post which is going to trigger something cool, but I'd like even the sending of that command from the A500 to be random too.
|
22 August 2018, 20:00 | #6 |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
Maybe achievable with ARexx scripts but I can't help you with those...
|
22 August 2018, 20:05 | #7 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
Ok thanks. Can you or anyone think of another way to do both commands maybe in AmigaBASIC?
|
22 August 2018, 21:11 | #8 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
How about...
Code:
wait `rx "say RANDOM(1,15,TIME('S'))"` |
22 August 2018, 23:41 | #9 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
|
23 August 2018, 00:10 | #10 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
Also is there a command to clear the AmigaDOS screen and start from the top?
And what about HTTP Post? Much appreciated. |
23 August 2018, 00:20 | #11 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
|
23 August 2018, 00:25 | #12 | |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
Quote:
...but you need this file in "SYS:C" (don't think it comes with a standard WB 3.1 install). Or if you're talking about when running from a Shell and removing the first line then: Code:
echo "*ec" noline Last edited by DamienD; 23 August 2018 at 00:31. |
|
23 August 2018, 00:29 | #13 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
Thanks! That just leaves sending an http command...?
|
23 August 2018, 00:43 | #14 | |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
Quote:
...but the one included in ClassicWB is way smaller and does the same thing; no idea where Bloodwych got it from? Attached anyway |
|
23 August 2018, 11:00 | #15 |
Registered User
Join Date: Feb 2008
Location: RNO
Posts: 1,006
|
It depends what TCP/IP stack you are using, or you have to rely on some 3rd party utilities.
If using AmiTCP/IP based stacks (AmiTCP/IP, Genesis, EasyNet...), you can mount TCP: device, which is pretty fun for this kind of stuff. You can just write (and/or read) anything you want to a TCP:hostaddress/portnumber "file". I've used this a lot with ARexx where you can open it as a file and then write lines into it and read lines for output, but I guess if you just want to send some specific commands to it, you can use something like this: Echo "POST blabla" > TCP:myserver.com/80 |
23 August 2018, 13:09 | #16 | |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Quote:
|
|
23 August 2018, 14:20 | #17 |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
Code:
echo "*ec" noline Before: After: |
23 August 2018, 14:25 | #18 |
Registered User
Join Date: Jul 2014
Location: Finland
Posts: 1,176
|
to send a HTTP POST, just use curl.
Has a Amiga port: http://aminet.net/package/comm/tcp/curl-7.10.5 curl -d "@yourdata.txt" -X POST http://yourservice.com/api/endpoint |
23 August 2018, 18:29 | #19 |
Registered User
Join Date: Jan 2014
Location: California
Posts: 1,146
|
Thank you guys!
(And it is AmiTCP) |
23 August 2018, 18:58 | #20 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Vampire V2+ or wait for V4 | Glen M | Amiga scene | 55 | 08 May 2018 21:56 |
AmigaDOS wait for user input | Sinphaltimus | Coders. Scripting | 11 | 25 February 2018 02:47 |
Where Time Stood Still - Video or wait? | Galahad/FLT | Amiga scene | 83 | 31 July 2014 11:42 |
Wait() | mritter0 | Coders. C/C++ | 2 | 17 May 2014 19:14 |
Wait a sec - what about Macs? | Computolio | Amiga scene | 10 | 02 June 2004 07:23 |
|
|