Wednesday, June 10, 2009
Batch File To Create Restore Point
runas /user:local\administrator
@echo off
title Test Utility
:prompt
color 4f
cls
echo Pick a Category
echo.
echo Type 1 to System Utilities
echo Type 2 to ""
echo Type 3 to ""
set /p answer=
if ‘%answer%’ == ‘1’ system
:system
cls
Echo Type 1 to System Restore
Echo Type 2 to ""
Echo Type 15 to Main Menu
set /p answer=
if '%answer%' == '1' goto system restore
:system restore
cls
IF EXIST %systemroot%\system32\restore\rstrui.exe= %systemroot%\system32\restore\rstrui.exe else
IF EXIST C:\Windows\System32\rstrui.exe = C:\Windows\System32\rstrui.exe
echo.
echo Pres Any Key to goto Menu
pause >nul
goto prompt
Create .VBS file To Create Restore Point
Step-1 Open Notepad
Step-2 Copy below code to Noteoad
set SRP = getobject("winmgmts:\\.\root\default:Systemrestore")
CSRP = SRP.createrestorepoint ("Restore Point Created By-Chintan Patel", 0, 100)
Step3 Save as RestorePoint.vbs
Step-4 Double click on RestorePoint.vbs to Take Restore Point
Note:
If you want to Take Restore Point when system start,
then drag that file in to STARTUP
Step-2 Copy below code to Noteoad
set SRP = getobject("winmgmts:\\.\root\default:Systemrestore")
CSRP = SRP.createrestorepoint ("Restore Point Created By-Chintan Patel", 0, 100)
Step3 Save as RestorePoint.vbs
Step-4 Double click on RestorePoint.vbs to Take Restore Point
Note:
If you want to Take Restore Point when system start,
then drag that file in to STARTUP
How to Start the System Restore Tool from a Command Prompt

To start the System Restore tool when you cannot start your Windows Me-based computer normally or in Safe mode, you can temporarily change the Windows shell from Explorer.exe to Progman.exe:
- Start your computer by using the Windows Me Startup disk.
- At the Startup menu, choose Minimum Boot.
- At the command prompt, type edit c:\windows\system.ini, and then press ENTER.
- Edit the shell= line so that it looks like this:shell=progman.exe
- Press ALT+F, and then press S to save the changes to the System.ini file.
- Press ALT+F, and then press X.
- Remove your Windows Me Startup disk, and then restart your computer. When your computer restarts, Program Manager should start. If Program Manager does not start, repeat steps 1 through 7, being careful to follow these steps exactly, and then continue to the next step.
- On the File menu, click Run, type msconfig in the Command Line box, and then press ENTER.
- Click Launch System Restore to begin restoring your computer to a previous, functional state.
Notes
- After you configure your computer to start Program Manager (Progman.exe), you can also start the System Restore tool by typing c:\windows\system\restore\rstrui.exe at a command prompt, and then pressing ENTER.
- If you still cannot use System Restore, repeat steps 1 through 6. In step 4, change the shell= line so that it reads: shell=explorer.exeThis sets the Windows shell back to Explorer.exe so that you can continue troubleshooting.
Tuesday, June 9, 2009
Print (Silent Print) From Java Applet
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.net.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.swing.*;
public class CopyOfPrinterApplet extends JApplet {
private PrintRequestAttributeSet aset;
DocFlavor DocFlavor;
public Doc doc;
DocPrintJob printerJob;
JTextPane pane;
/**
* DOCUMENT ME!
*/
public void init() {
getContentPane().setLayout(new BorderLayout());
pane = new JTextPane();
pane.setSize(150, 100);
pane.setContentType("text/html");
pane.setText(
"<center><b><big>Applet Test</big></b>
"
+ "</center>");
getContentPane().add(pane, "Center");
JPanel buttons = new JPanel();
buttons.setBackground(Color.white);
JButton print = new JButton("Print");
buttons.add(print);
getContentPane().add(buttons, "South");
print.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
print();
}
});
}
/**
* DOCUMENT ME!
*/
void prep() {
URL url = null;
aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
aset.add(new Copies(1));
try {
url =
new URL("http://www.emanuelblagonic.com/wp-content/uploads/2007/06/google-homepage.jpg");
} catch (MalformedURLException e) {
e.printStackTrace();
}
PrintService pservices =
PrintServiceLookup.lookupDefaultPrintService();
System.out.println(pservices.getName());
DocFlavor flavor = javax.print.DocFlavor.INPUT_STREAM.JPEG;
PrintRequestAttributeSet attr_set = new HashPrintRequestAttributeSet();
attr_set.add(new Copies(1));
PrintService[] service = PrintServiceLookup.lookupPrintServices(flavor, attr_set);
doc = new SimpleDoc(url, javax.print.DocFlavor.URL.PDF, null);
try {
System.out.println("DOC : \n " + doc.getPrintData());
} catch (IOException e) {
e.printStackTrace();
}
/* Create a Print Job */
printerJob = pservices.createPrintJob();
}
/**
* DOCUMENT ME!
*/
void print() {
prep();
System.out.println("Printer Name : " +
printerJob.getPrintService());
try {
printerJob.print(doc, aset);
} catch (PrintException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Done Printing.");
}
}
import java.awt.event.*;
import java.io.IOException;
import java.net.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.swing.*;
public class CopyOfPrinterApplet extends JApplet {
private PrintRequestAttributeSet aset;
DocFlavor DocFlavor;
public Doc doc;
DocPrintJob printerJob;
JTextPane pane;
/**
* DOCUMENT ME!
*/
public void init() {
getContentPane().setLayout(new BorderLayout());
pane = new JTextPane();
pane.setSize(150, 100);
pane.setContentType("text/html");
pane.setText(
"<center><b><big>Applet Test</big></b>
"
+ "</center>");
getContentPane().add(pane, "Center");
JPanel buttons = new JPanel();
buttons.setBackground(Color.white);
JButton print = new JButton("Print");
buttons.add(print);
getContentPane().add(buttons, "South");
print.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
print();
}
});
}
/**
* DOCUMENT ME!
*/
void prep() {
URL url = null;
aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
aset.add(new Copies(1));
try {
url =
new URL("http://www.emanuelblagonic.com/wp-content/uploads/2007/06/google-homepage.jpg");
} catch (MalformedURLException e) {
e.printStackTrace();
}
PrintService pservices =
PrintServiceLookup.lookupDefaultPrintService();
System.out.println(pservices.getName());
DocFlavor flavor = javax.print.DocFlavor.INPUT_STREAM.JPEG;
PrintRequestAttributeSet attr_set = new HashPrintRequestAttributeSet();
attr_set.add(new Copies(1));
PrintService[] service = PrintServiceLookup.lookupPrintServices(flavor, attr_set);
doc = new SimpleDoc(url, javax.print.DocFlavor.URL.PDF, null);
try {
System.out.println("DOC : \n " + doc.getPrintData());
} catch (IOException e) {
e.printStackTrace();
}
/* Create a Print Job */
printerJob = pservices.createPrintJob();
}
/**
* DOCUMENT ME!
*/
void print() {
prep();
System.out.println("Printer Name : " +
printerJob.getPrintService());
try {
printerJob.print(doc, aset);
} catch (PrintException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Done Printing.");
}
}
Subscribe to:
Posts (Atom)