File: the creator of linux.swf-(3.42 MB, 1920x944, Loop)
[_] Anonymous 03/10/23(Fri)20:09:07 No.3493214
package main;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
import java.util.Random;
public class SWFRandomizer {
static final ArrayList<File> FILE_LIST = new ArrayList<>(Arrays
.asList(Objects.requireNonNull(new File("R:\\STUFF FOLDER\\lel").listFiles()))); // hardcode your
path here
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(600,600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("SWF Randomizer");
frame.setVisible(true);
JButton button = new JButton("~~~~~~Get a SWF!~~~~~~");
button.setBounds(50,100,900,900);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
getRandomSwf();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
});
frame.add(button);
}
public static void getRandomSwf() throws Exception{
File currentSwf = getRandomFile();
if(currentSwf.isDirectory()) { // remove directories when found
FILE_LIST.remove(currentSwf);
currentSwf = getRandomFile();
}
Desktop.getDesktop().open(currentSwf);
FILE_LIST.remove(currentSwf);
}
public static File getRandomFile() {
Random rand = new Random();
int index = rand.nextInt(FILE_LIST.size());
return FILE_LIST.get(index);
}
}
>> [_] Anonymous 03/10/23(Fri)20:10:22 No.3493215
// java 17 class i wrote to play random swf files, instead of having to click through them like i
always do
// from a directory hardcoded below, see comments, only opens .swf extensions
// windows extension must be defaulted to a flash player, can be done by downloading a standalone
flash player and setting it to default in windows
// will play any file from the hard coded directory, will not play duplicates as long as the app
remains open
can be exported to an executable jar that can be run for anywhere
>> [_] Anonymous 03/10/23(Fri)23:12:17 No.3493218
The Creator of Linux would simply need to do:
flashplayer "$(ls *.swf | shuf -n 1)"
Switch already, Anon!
>> [_] Anonymous 03/11/23(Sat)00:30:38 No.3493219
>>3493218
That picks a uniformly random swf every time with no memory between invocations, whereas OP's
Java application will remove flashes from the list and therefore never play a flash twice in one
session.
The fix is to move the chosen flash to another directory, or put something between that ls and
shuf to remove flashes with some sort of tag in the name and then add that tag to the chosen
flash's name.
>> [_] Anonymous 03/11/23(Sat)01:25:42 No.3493221
>>3493219
ls *.swf | shuf | while read flash; do flashplayer "$flash"; done
Pipes are much easier
>> [_] Anonymous 03/11/23(Sat)08:00:36 No.3493224
>>3493215
blimey!
>> [_] Anonymous 03/11/23(Sat)12:16:19 No.3493229
>>3493221
Impressive. Very nice. Let's see Paul Allen's script.
>> [_] Anonymous 03/12/23(Sun)05:07:51 No.3493251
>>3493221
Very good!
>> [_] Anonymous 03/13/23(Mon)02:38:13 No.3493269
>>3493221
But can it run on my DVD player? See this is the advantage Java has! 3 Billion devices!
>> [_] Anonymous 03/13/23(Mon)09:58:33 No.3493270
>>3493229
>Look at those subtle declarations. The tasteful variable names. Oh my God. It doesn't even have
an import.