Jaja, yo también tenía ganas de hacer un tutorial, pero no tengo info base =/, pero el tuyo es lejos el mejor que he visto ![:D :D](https://forum.elhacker.net/Smileys/navidad/cheesy.gif)
Ok, gracias Novlucker
![:D :D](https://forum.elhacker.net/Smileys/navidad/cheesy.gif)
Ok, gracias Novlucker
![;) ;)](https://forum.elhacker.net/Smileys/navidad/wink.gif)
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
select case wscript.arguments(0)
case "/?"
call help
case else
call selmsg
end select
sub selmsg
dim c
c=0
for each var in wscript.arguments
c = c + 1
next
select case c
case 1
call msg1
case 2
call msg2
case 3
call msg3
end select
end sub
sub msg1
msgbox wscript.arguments(0)
end sub
sub msg2
dim icon
icon = 0
select case wscript.arguments(1)
case 0
icon = 0
case 1
icon = vbcritical
case 2
icon = vbinformation
case 3
icon = 48
case 4
icon = vbquestion
end select
msgbox wscript.arguments(0), icon
end sub
sub msg3
dim icon
icon = 0
select case wscript.arguments(1)
case 0
icon = 0
case 1
icon = vbcritical
case 2
icon = vbinformation
case 3
icon = 48
case 4
icon = vbquestion
end select
msgbox wscript.arguments(0), icon, wscript.arguments(2)
end sub
sub help
wscript.echo "Uso:"
wscript.echo "Cscript /nologo msg.vbs [Mensaje] [Tipo] [Titulo]"
wscript.echo "[Mensaje]: Prompt para el cuadro de dialogo"
wscript.echo "[Tipo]: Tipo de icono "
wscript.echo "0 - Sin icono"
wscript.echo "1 - Error"
wscript.echo "2 - Informacion"
wscript.echo "3 - Advertencia"
wscript.echo "4 - Pregunta"
wscript.echo "Para pasar un argumento, el argumento anterior debe ser declarado,"
wscript.echo "por ejemplo, si se pone un icono y se omite el Mensaje"
wscript.echo "el mensaje sera la opcion ingresada para el icono"
wscript.echo ""
end sub
cscript /nologo <ruta_del_archivo>.vbs <argumento_1> <argumento_2> <argumento_3>
import javax.swing.*;
public class clase{
boolean ctp;
int[][] vec = new int[3][3];
int[] a = new int[9];
int[] b = new int[9];
int[] c = new int[9];
int ia = 0, ib = 0, ic = 0;
public clase(int ctrl){
switch(ctrl){
case 1:
sub_principal();
break;
case 2:
sub_numeros();
break;
case 3:
sub_arreglos();
break;
case 4:
System.exit(0);
break;
}
}
public static void Main(String[] args){
}
void sub_principal(){
ctp=true;
while(ctp){
int m = Integer.parseInt(JOptionPane.showInputDialog(null, "1- Ingresar una frase para contar sus caracteres \n\n 2- Ingresar un Nombre para mostrar en minúsculas o mayúsculas \n\n 3- Volver \n\n 4- Salir"));
switch(m){
case 1:
String frase = JOptionPane.showInputDialog(null, "Ingrese una frase");
JOptionPane.showMessageDialog(null, "La frase tiene " + frase.length() + " caracteres");
break;
case 2:
String nombre = JOptionPane.showInputDialog(null, "Ingrese un nombre");
JOptionPane.showMessageDialog(null, nombre.toUpperCase());
break;
case 3:
ctp=false;
break;
case 4:
new clase(4);
break;
}
new clase(1);
}
}
void sub_numeros(){
ctp=true;
while(ctp){
int s = Integer.parseInt(JOptionPane.showInputDialog(null, "1- Ver si el numero es primo \n\n 2- Ver si el numero es perfecto \n\n 3- Calcular MCM entre dos numeros \n\n 4- Volver 5- Salir"));
switch(s){
case 1:
int op = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese el numero"));
if (esPrimo(op)){
JOptionPane.showMessageDialog(null, s + "Es primo");
}else{
JOptionPane.showMessageDialog(null, s + "No es primo");
}
break;
case 2:
int op2 = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese el numero"));
if (esPerfecto(s)){
JOptionPane.showMessageDialog(null, s + "Es perfecto");
}else{
JOptionPane.showMessageDialog(null, s + "No es perfecto");
}
break;
case 3:
JOptionPane.showMessageDialog(null, "Aun no implementada XD");
break;
case 4:
ctp=false;
break;
case 5:
new clase(4);
break;
}
new clase(1);
}
}
void sub_arreglos(){
ctp=true;
while(ctp){
int in = Integer.parseInt(JOptionPane.showInputDialog(null, "1- Ingresar numeros para la matriz \n\n 2- Volver \n\n 3-Salir"));
switch (in){
case 1:
int c=1;
for (int x=0;x<3;x++){
for (int y=0;y<3;y++){
vec[x][y] = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese numero " + c));
c++;
if(vec[x][y]%2==0){
a[ia] = vec[x][y];
ia++;
}else if (vec[x][y]%2!=0){
b[ib] = vec[x][y];
ib++;
}
if (vec[x][y]<0){
c[ic] = vec[x][y];
ic++;
}
}
}
String pares="";
for (int valor:a){
pares += "[" + Integer.toString(valor) + "]";
}
JOptionPane.showMessageDialog(null, "Los numeros pares son \n\n" + pares);
String impares="";
for (int valor:a){
impares += "[" + Integer.toString(valor) + "]";
}
JOptionPane.showMessageDialog(null, "Los numeros impares son \n\n" + impares);
String negativos="";
for (int valor:a){
negativos += "[" + Integer.toString(valor) + "]";
}
JOptionPane.showMessageDialog(null, "Los numeros negativos son \n\n" + negativos);
break;
case 2:
ctp = false;
break;
case 3:
new clase(4);
break;
}
}
new clase(1);
}
boolean esPrimo(int p){
int c;
for (int x=p;x>0;x--){
if (p%x==0){
c++;
}
}
if (c==2){
return true;
}else{
return false;
}
}
boolean esPerfecto(int p){
int res=0;
for(int y=1;y<=p/2;y++){
if (p%y==0){
res = res + y;
}
}
if (res == p) {
return true;
}else{
return false;
}
}
}
set exc=createobject("excel.application")
set wss=createobject("wscript.shell")
exc.visible = true
' preparando el archivo
set ambiente = exc.workbooks.add()
wss.sendkeys "+({f11})"
wscript.sleep 200
wss.sendkeys "+({f11})"
wscript.sleep 200
wss.sendkeys "+({f11})"
wscript.sleep 200
wss.sendkeys "+({f11})"
wscript.sleep 200
'preparando la hoja PCs
set fecha1 = exc.range("B2")
fecha1.interior.colorindex = 28
fecha1.formula = "Ingrese fecha"
fecha1.borders.colorindex = 1
set fecha2 = exc.range("C2")
fecha2.interior.colorindex = 28
fecha2.borders.colorindex = 1
fecha2.formula = "01-01-2012"
fecha2.select
wss.sendkeys "{f2}"
wss.sendkeys "{enter}"
set fecha3 = exc.range("C8")
fecha3.interior.colorindex = 28
fecha3.borders.colorindex = 1
fecha3.formula = "=C2+1"
fecha3.select
wss.sendkeys "{f2}"
wss.sendkeys "{enter}"
set rango1 = exc.range("C10:H10")
rango1.interior.colorindex = 1
rango1.font.colorindex = 4
rango1.font.bold = true
exc.range("c10").formula = "PC 1"
exc.range("d10").formula = "PC 2"
exc.range("e10").formula = "PC 3"
exc.range("f10").formula = "PC 4"
exc.range("g10").formula = "PC 5"
exc.range("h10").formula = "PC 6"
set rango2 = exc.range("C11:h19")
rango2.interior.colorindex = 15
rango2.borders.colorindex = 1
set rangof = exc.range("C20:H20")
rangof.interior.colorindex = 28
rangof.borders.colorindex = 1
rangof.select
set f1 = exc.range("C20")
f1.formula = "=suma(C11:C19)"
f1.select
wss.sendkeys "{f2}"
wss.sendkeys "{enter}"
wscript.sleep 666
wss.sendkeys "{up}"
wss.sendkeys "^(c)"
wss.sendkeys "+({right})"
wss.sendkeys "+({right})"
wss.sendkeys "+({right})"
wss.sendkeys "+({right})"
wss.sendkeys "+({right})"
wss.sendkeys "{enter}"
wscript.sleep 200
set total = exc.range("H22")
total.formula = "=suma(C11:H19)"
total.select
wss.sendkeys "{f2}"
wss.sendkeys "{enter}"
' -------------------------
'copiando el cuadro al resto de la hoja
set stotal = exc.range("G22")
stotal.formula = "Total"
set rango3 = exc.range("C8:H22")
rango3.select
wss.sendkeys "^(c)"
dim control
control=1
' bajar 16 y pegar
do
for i=1 to 20 step 1
wss.sendkeys "{down}"
if control = 32 then
exit do
end if
next
wss.sendkeys "^(v)"
wscript.sleep 200
control = control + 1
loop
exc.columns("B").entirecolumn.autofit
' eso, el resto está listo para pasar a la siguiente hoja
for x=8 to 628 step 20
if x>8 then
resta= x-20
exc.cells(x, 3).formula = "=C"&resta&"+1"
exc.cells(x, 3).select
wss.sendkeys "{f2}"
wss.sendkeys "{enter}"
wscript.sleep 200
end if
fecha2.formula = ""
next
exc.range("C8").formula = "=C2"
exc.range("c8").select
wss.sendkeys "{f2}"
wss.sendkeys "{enter}"
'*****************************************
'*****************************************
' SEGUNDA HOJA
'*****************************************
'*****************************************
wss.sendkeys "^{pgdn}"