ForumsProgramming ForumVBScripts and/or JavaScripts... Paste examples here

30 7700
Qwerty001
offline
Qwerty001
422 posts
Nomad

I've been screwin' around with both of these and I've come up with a few...
If you want to see what mine do copy and paste into notepad and save as .vbs

1.Dim Counter
Counter = 0
While Counter < 10000
Counter = Counter + 1
msgbox Counter,0+18,"This will close when it reaches 10001"
Wend

(My personal fave)
2.Dim Input
Input = InputBox("Enter your name [Please capatilize]","Message From Yoda","Here, reply you should&quot
if Input = "" then MsgBox ("Type, can you not?&quot else MsgBox ("An idiot, is &quot & Input

3.Dim Input
Input = InputBox("Enter your name [Capatilize please]","Message From Yoda","Type your response here&quot
if Input = "" then MsgBox ("Please enter your name&quot else MsgBox (Input +" is a dork!&quot

4.Dim Input
Input = InputBox("Enter your name&quot
if Input = "" then MsgBox ("Please enter your name&quot else MsgBox (Input +" is your name, right?&quot

5.Do Until DefResp = vbNo
MyNum = Int (999 * Rnd + 1)
DefResp = MsgBox (MyNum & " Do you want another randomized number?", vbYesNo)
Loop

Dim Check, Counter
Check = True: Counter = 0
Do
Do While Counter < 20
Counter = Counter + 1
If Counter = 10 Then
Check = False
Exit Do
End If
Loop
Loop Until Check = False

6.Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell&quot

BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:", 4 + 32)

Select Case BtnCode
case 6 WScript.Echo "Glad to hear you feel alright."
case 7 WScript.Echo "Hope you're feeling better soon."
case -1 WScript.Echo "Is there anybody out there?"
End Select

7.Dim MyValue, Response
Randomize
Do Until Response = vbNo
MyValue = Int((6 * Rnd) + 1)
MsgBox MyValue
Response = MsgBox ("Roll again? ", vbYesNo)
Loop


You can also make these go on and on by adding Do and Loop...
If you accidentlly open these right-click on your bar that shows time and pick [i]Task Manager
Such as...

Do
Dim Input
Input = InputBox("Enter your name [Please capatilize]","Message From Yoda","Here, reply you should&quot
if Input = "" then MsgBox ("Type, can you not?&quot else MsgBox ("An idiot, is &quot & Input
Loop



You're Welcome...
Qwerty001

  • 30 Replies
Drace
offline
Drace
3,880 posts
Nomad

Nice lol.

I is an Idiot.

Qwerty001
offline
Qwerty001
422 posts
Nomad

Also if anyone knows how to make a MessageBox stop on Abort then shutdown the computer. It's a joke for my geeky friends...

IQAndreas
offline
IQAndreas
299 posts
Peasant

I did run across some code one time that asked a user "Do you need a drink holder?"
If they clicked Yes, the CD tray popped out. ;-)

I'll try to find that one. It is quite amusing.

Qwerty001
offline
Qwerty001
422 posts
Nomad

Thanks IqAndreas! Also, if youn postbe sure to specify if it is JScript or VBScript

dank
offline
dank
986 posts
Peasant

Here's a little socket server. It's pretty old though, so I don't remember quite how to use it. :P Made for commuting with multiple .swf clients.

Java

import java.net.*;
import java.io.*;

public class socketServer {
public static void main(String[] args) throws IOException {

ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(528);
} catch (IOException e) {
System.err.println("Could not listen on port: 528.&quot;
System.exit(1);
}

Socket clientSocket = null;
try {
clientSocket = serverSocket.accept();
} catch (IOException e) {
System.err.println("Accept failed.&quot;
System.exit(1);
}

PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

int i = -99999;
while(i > 999999){
out.println("Sending data to client&quot;
}

out.close();
in.close();
clientSocket.close();
serverSocket.close();
}
}
Qwerty001
offline
Qwerty001
422 posts
Nomad

Here's a JScript file.
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24;x4=300;y4=200;

x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0;

i-DIL; i++){DIS=DI[ i

].style;DIS.position='absolute';DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;DIS.top

=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5);void(0);

Copy it and paste it into the address bar. You'll see what it does.
Make sure the website you do it on has images.

Qwerty001
offline
Qwerty001
422 posts
Nomad

Wait it has to be this, sorry!

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24;x4=300;y4=200;x5=300; y5=200; DI=document.images; DIL=DI.length;function A(){for(i=0;i-DIL; i++){DIS=DI[ i ].style;DIS.position='absolute';DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5);void(0);

Drace
offline
Drace
3,880 posts
Nomad

I did run across some code one time that asked a user "Do you need a drink holder?"
If they clicked Yes, the CD tray popped out. ;-)

I'll try to find that one. It is quite amusing.


LOL.

Too bad my cd drive is broken and I have to open it up with a pin...
Qwerty001
offline
Qwerty001
422 posts
Nomad

About my code: make sure it is not on about:blank, make sure it is on a page with lots of pics. Like an AG game comment page

IQAndreas
offline
IQAndreas
299 posts
Peasant

Try this one. It is partially made from some code I stole off of Qwerty001's site.

Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection

If colCDROMs.Count >= 1 then
If MsgBox("Do you need somewhere to place your drink?", vbYesNo) = vbYes
colCDROMs.Item(0).Eject
End If
End If


I have not tested this code, but I'm assuming it will work just fine.
Qwerty001
offline
Qwerty001
422 posts
Nomad

Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
If colCDROMs.Count >= 1 then
If MsgBox("Do you need somewhere to place your drink?", vbYesNo) = vbYes then colCDROMs.Item(0).Eject
End If

This one works IqAndreas... I fixed it. Hope you liked my site!

Qwerty001
offline
Qwerty001
422 posts
Nomad

Here's a .js file that does what my previous post does except in a different formation.

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img&quot; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.tan(R*x1+i*x2+x3)*x4+x5)+&quotx"; DIS.top=(Math.sin(R*y1+i*y2+y3)*y4+y5)+&quotx"}R++}setInterval('A()',5); void(0);

Here's my old one:

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24;x4=300;y4=200;x5=300; y5=200; DI=document.images; DIL=DI.length;function A(){for(i=0;i-DIL; i++){DIS=DI[ i ].style;DIS.position='absolute';DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5);void(0);
IQAndreas
offline
IQAndreas
299 posts
Peasant

Would it be possible for you to include the entire code, including all the HTML or whatever is necessary? That way, it is easier for us to just copy and paste to try it.

I'm just not 100% sure where to place the JavaScript in an HTML file.

Qwerty001
offline
Qwerty001
422 posts
Nomad

This only works as a js injection on the URL on a page with .img files... I have some .js files that you can put in as HTML...

Qwerty001
offline
Qwerty001
422 posts
Nomad

There is like <body> and <head> and stuff like that...

Try ... They have downloads, examples and lots of other stuff...

Showing 1-15 of 30