Forums → Programming Forum → VBScripts and/or JavaScripts... Paste examples here
30 | 7700 |
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"
if Input = "" then MsgBox ("Type, can you not?" else MsgBox ("An idiot, is " & Input
3.Dim Input
Input = InputBox("Enter your name [Capatilize please]","Message From Yoda","Type your response here"
if Input = "" then MsgBox ("Please enter your name" else MsgBox (Input +" is a dork!"
4.Dim Input
Input = InputBox("Enter your name"
if Input = "" then MsgBox ("Please enter your name" else MsgBox (Input +" is your name, right?"
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"
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"
if Input = "" then MsgBox ("Type, can you not?" else MsgBox ("An idiot, is " & Input
Loop
You're Welcome...
Qwerty001
- 30 Replies
Also if anyone knows how to make a MessageBox stop on Abort then shutdown the computer. It's a joke for my geeky friends...
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.
Thanks IqAndreas! Also, if youn postbe sure to specify if it is JScript or VBScript
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."
System.exit(1);
}
Socket clientSocket = null;
try {
clientSocket = serverSocket.accept();
} catch (IOException e) {
System.err.println("Accept failed."
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"
}
out.close();
in.close();
clientSocket.close();
serverSocket.close();
}
}
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.
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);
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...
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
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.
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!
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" 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)+"x"; DIS.top=(Math.sin(R*y1+i*y2+y3)*y4+y5)+"x"}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);
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.
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...
Thread is locked!