English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 22 August 2018, 19:25   #1
Starglider 2
Registered User
 
Starglider 2's Avatar
 
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?
Starglider 2 is offline  
Old 22 August 2018, 19:41   #2
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
AmigaDOS - Wait
DamienD is offline  
Old 22 August 2018, 19:49   #3
Starglider 2
Registered User
 
Starglider 2's Avatar
 
Join Date: Jan 2014
Location: California
Posts: 1,146
Thanks, I know about Wait but that doesn't satisfy the random requirement.
Starglider 2 is offline  
Old 22 August 2018, 19:55   #4
DamienD
Banned
 
DamienD's Avatar
 
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?
DamienD is offline  
Old 22 August 2018, 19:58   #5
Starglider 2
Registered User
 
Starglider 2's Avatar
 
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.
Starglider 2 is offline  
Old 22 August 2018, 20:00   #6
DamienD
Banned
 
DamienD's Avatar
 
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...
DamienD is offline  
Old 22 August 2018, 20:05   #7
Starglider 2
Registered User
 
Starglider 2's Avatar
 
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?
Starglider 2 is offline  
Old 22 August 2018, 21:11   #8
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
How about...

Code:
wait `rx "say RANDOM(1,15,TIME('S'))"`
alkis is offline  
Old 22 August 2018, 23:41   #9
Starglider 2
Registered User
 
Starglider 2's Avatar
 
Join Date: Jan 2014
Location: California
Posts: 1,146
Quote:
Originally Posted by alkis View Post
How about...

Code:
wait `rx "say RANDOM(1,15,TIME('S'))"`
It works! Thank you!
Starglider 2 is offline  
Old 23 August 2018, 00:10   #10
Starglider 2
Registered User
 
Starglider 2's Avatar
 
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.
Starglider 2 is offline  
Old 23 August 2018, 00:20   #11
Starglider 2
Registered User
 
Starglider 2's Avatar
 
Join Date: Jan 2014
Location: California
Posts: 1,146
Quote:
Originally Posted by DamienD View Post
cls
With or without the emoji?

Just kidding. Thanks!
Starglider 2 is offline  
Old 23 August 2018, 00:25   #12
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Quote:
Originally Posted by starglider 2 View Post
also is there a command to clear the amigados screen and start from the top?
This would be "CLS"

...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
Edit: ooops sorry, removed my post and re-created but you had quoted / replied while I was doing so

Last edited by DamienD; 23 August 2018 at 00:31.
DamienD is offline  
Old 23 August 2018, 00:29   #13
Starglider 2
Registered User
 
Starglider 2's Avatar
 
Join Date: Jan 2014
Location: California
Posts: 1,146
Thanks! That just leaves sending an http command...?
Starglider 2 is offline  
Old 23 August 2018, 00:43   #14
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Quote:
Originally Posted by DamienD View Post
This would be "CLS"

...but you need this file in "SYS:C" (don't think it comes with a standard WB 3.1 install).
You can grab CLS from Animet: http://aminet.net/package/util/cli/cls

...but the one included in ClassicWB is way smaller and does the same thing; no idea where Bloodwych got it from?

Attached anyway
Attached Files
File Type: lha cls.lha (151 Bytes, 80 views)
DamienD is offline  
Old 23 August 2018, 11:00   #15
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,006
Quote:
Originally Posted by Starglider 2 View Post
Thanks! That just leaves sending an http command...?
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
jPV is offline  
Old 23 August 2018, 13:09   #16
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Quote:
Originally Posted by DamienD View Post
You can grab CLS from Animet: http://aminet.net/package/util/cli/cls
You also have "clear" in any shell. It's defined in S:Shell-startup.
idrougge is offline  
Old 23 August 2018, 14:20   #17
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Code:
echo "*ec" noline
...works well from CLI or Shell

Before:



After:

DamienD is offline  
Old 23 August 2018, 14:25   #18
Locutus
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
Locutus is offline  
Old 23 August 2018, 18:29   #19
Starglider 2
Registered User
 
Starglider 2's Avatar
 
Join Date: Jan 2014
Location: California
Posts: 1,146
Thank you guys!

(And it is AmiTCP)
Starglider 2 is offline  
Old 23 August 2018, 18:58   #20
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by DamienD View Post
Code:
echo "*ec" noline
...works well from CLI or Shell
You may also type ctrl-L in place of "*ec".
meynaf is online now  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:56.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10932 seconds with 16 queries