Está en la página 1de 1

EXTRACT of my post from forum......................................

THE SCRIPT .vbs has been modified because of grubby work by me


Fri, Jun 5, 2009
AND AGAIN WITH THE NEW .sh Linux / .bat Win server 2003 Resource Kit Tools (works in XP desktop and newer)
UPDATED Sat, Jun 6, 2009 at approx. 8:00 PM
Note: Adjust all the lines in the scripts/batches for the X and Y arguments to the
java class.
e.g.
java -classpath "/home/scripJbat" Mpress 50 180
SUCCESS (but with both .vbs WSH script AND a Java2 class together in a folder)
MS Corp.Windows OS only:
(requires at least versions: Microsoft Windows Script Host Shell " W S H 5.6"
and also as minimum level Java2 Runtime Environment JV M of later sub-version Sun Microsystems Inc. JRE 1.4.2):
Robot mouse press script - Download UR L:
http://www.nicephotog-jsp.net/scrip(05-06-2009).zip
or Download URL 2 (zipped "php is the C G I script"):
http://www.nicephot.xlphp.net/scrip-05-06-2009.php
Empty the zip onto drive c:\ with your zip archive decompressor using its' setting "use folder names".
There is only one folder that contains the scripts and must be on c:\ drive at that folder path level. So it should be c:\scrip
A few points about setting up W XtoImg to use with this first.
note: The location of the program in the .vbs for program start
is C:\Progra~1\WXtoImg\xwxtoimg.exe . If you place the program somewhere else
when you install WXtoImg you will need to change that line to the .exe but don't
forget to use the \\ double back-slash (doubled reverse solidus) syntax when writing it in.
1. After install, put in your land based location as close as possible first.
2. Be sure to update the "kelpers" for the sattelites or the WXtoImg program will
crash.
3. Before attempting to tune this robot script-system to the job restart
the WXtoImg program and always leave it in the position and size you have pre tuned
the robot mouse pointer movement to land at for the button press or it will miss when
you use this automation script system.
4. If you use the "advanced GUI" option of the WXtoImg program be sure that it is set
and tuned to that before using this automated script system or the mouse pointer
could miss pressing the record button.
NEXT UPDATED Sat, Jun 6, 2009 at approx. 8:00 PM for timing system at startup
Alternate (easier) M S Win .bat system / OR / L INUX SHE LL and the Java class
Requires a download from Microsoft.com of approx. 12 Mbytes
Windows Server 2003 Resource Kit Tools (download rktools.exe)
http://technet.microsoft.com/en-au/windowsserver/bb405955.aspx
and a 1.4.2 Java2 JRE as above.
Alternative download UR L:
http://www.nicephotog-jsp.net/scripJbat(06-06-2009).zip
(so all you need to know now is how to wake a computer and have pre set up a task to start WXtoImg by the .vbs and java.awt.Robot java class)
All you need know now also is how to modify the coordinates X and Y position of where to land your mouse-pointer when running the script.
These two arguments in these lines in the script
after testing where the mouse pointer should land
using test-run.bat first...
XcoordButton = "150"
YcoordButton = "455"
Two things i should have explained..........
1. wherever the window was last opened in pixel position in the screen and (usually size) is how and where the application will start.
b. do not have any other windows open either at startup or when running the .bat
Don't move your application window around or resize it after that!!!!!!!!!!!!!!!!!!!!!!!!
AUTO-WX-ATTEMPT.vbs next
Code:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
''
AUTO-WX-ATTEMPT.vbs written by Mr.Samuel A Marchant Sydney Australia May 2009 in SucommanderXer Last Pre Beta (version: 31-01-2009)
set wscl = WScript.CreateObject("WScript.Shell")
WScript.Sleep 60000
exline="C:\\Progra~1\\WXtoImg\\xwxtoimg.exe"
WScript.Sleep 60000
wscl.exec(exline)
WScript.Sleep 60000 ' ( SHOULD BE SET AT - 60000 = 1 MINUTE - ) THIS ONE MUST ALWAYS TAKE MORE THAN 20 SECONDS
''
NEXT ARE THE SCREEN POSITION OF THE BUTTON IN WXtoImg FOR "record" ON THE SUB GUI
' THEY ARE LITERALS MEANING REPLACE THEM WITH AN INTEGER(in this instance) NUMBER ONLY AS THEY ARE READ ON THE LINE
' THESE ARE COMMANDLINE ARGUMENTS SO BE SURE THEY ARE ENCLOSED IN DOUBLE QUOTES (NO SPACES ON EITHER END)
' IN MY VERSION AT 1024 X 768
XcoordButton = "150"
YcoordButton = "455"
''
NEXT sleeps the script and WAITS FOR THE GUI TO BE PROPERLY BUILT AND REMOVED OF THE SPLASH SCREEN
WScript.Sleep 5000
' WXtoImg is the spelling on my copy
wscl.AppActivate "WXtoImg [Freeware edition]"
WScript.Sleep 1000
' NEXT ALT key on the first menu
wscl.SendKeys("%")
WScript.Sleep 100
wscl.SendKeys("{DOWN}")
WScript.Sleep 100
wscl.SendKeys("{DOWN}")
WScript.Sleep 100
wscl.SendKeys("{DOWN}")
WScript.Sleep 100
wscl.SendKeys("{DOWN}")
WScript.Sleep 100
wscl.SendKeys("{DOWN}")
WScript.Sleep 100
wscl.SendKeys("{DOWN}")
WScript.Sleep 100
wscl.SendKeys("{DOWN}")
WScript.Sleep 100
' NEXT enter is on the record tab 7th down the list
wscl.SendKeys("{ENTER}")
WScript.Sleep 6000
' ==================== MODIFY THE MOUSE PRESS COORDINATES ABOVE ON LINES 14 (XcoordButton) AND 15 (YcoordButton) AS DESCRIBED IN THE COMMENTS =========
' == USE test-run.bat BY EDITING THEN TRIGGERING TO TEST WHERE THE MOUSE WILL LAND AND PRESS (IT TRIGGERS THE Mpress CLASS ALONE ONLY) ==
exline="javaw Mpress " & XcoordButton & " " & YcoordButton
wscl.exec(exline)
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
MpressControl.sh FOR LINUX NOTE:the first # @@@@ comment line below
Code:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#!/bin/sh
# @@@@@@@ /home/scripJbat MUST BE THE LOCATION OF the scripJbat folder and java class Mpres
# @@@@@@@ OR ERROR WILL RESULT
# written by mr. Samuel A Marchant Sydney Australia 06-06-2009
#
# GRANT THIS PERMISSION TO ==EXECUTE== ON THE FILES PROPERTIES TAB FIRST
#
# NOTE: ***AUTOMATIC START AND RESTART*** OF THE MACHINE IS DONE BY "BIOS" POWER MANAGEMENT
# WHILE IT CAN BE PROGRAMMED IT IS OFTEN DONE THROUGH USE OF A SYSTEM CALLED W.O.L.
# Wake On LAN(Local Area Network) of some Main-Boards have a special jack connector or
# is on a 10/100 network card, HOWEVER, THE MAIN METHOD IS DONE BY USING A SPECIAL
# EXTERNAL DEVICE CALLED A MANAGED U.P.S. (Uninterrupted Power Supply) AND ITS SOFTWARE.
# http://www.newbtopro.com/guide/part_3_setting_bios
# http://www.linux.com/news/hardware/laptops/8253-how-to-suspend-and-hibernate-a-laptop-under-linux
#
# swsusp command kernal 2.6. [poweroff reboot shutdown and halt ARE NOT OF USE FOR
# AUTOMATIC RESTART]
# http://fchabaud.free.fr/English/Tricks/Laptop/Swsusp/Doc/Software-suspend-1.html#ss1.1
# http://www.tuxonice.net/HOWTO-4.html#ss4.1
#
# note: that cron itself is simply the daemon and is modified by the
# crontab command http://webtools.live2support.com/linux/crontab.php
#
# NOTE: crontab does not like su as the user so use a username that
# the machine will either start into or running when the command is run
# to run this shell script
#
# cron emails the output of the command to the user but that can be
# suppressed SEE: http://webtools.live2support.com/linux/crontab.php
#http://www.linux.com/archive/feature/43774
#
# BE SURE CRON IS ALWAYS SET TO BE STARTED AT MACHINE STARTUP
#
# this script should remain in the folder where the folder is placed
# and chrontab should be used to set the command ro issue a shell
# command by the cron daemon
# ==================================================================================================
# if the next shell command line(pair) does not operate check ownership of the
# wxtoimg binary. Also that it has executable ability on the properties tab
# or just attempt any these pair lines set below by uncommenting
#cd /usr/local/bin
#./wxtoimg
# or this
#cd /usr/local/bin
#wxtoimg
# or finally this (can be the case for a binary)
#cd /
#/usr/local/bin/wxtoimg
#c
d /usr/local/bin
exec ./wxtoimg
# sleep until startup is complete
sleep 180
# caution on 8 bit speed systems note sleep is not real world timimg
sleep 20
# first the alt button
java -classpath "/home/scripJbat" Mpress 50 45
sleep 5
# open record panel
java -classpath "/home/scripJbat" Mpress 50 180
sleep 10
# press record button after waiting for sub GUI to build
java -classpath "/home/scripJbat" Mpress 175 470
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
MpressControl.bat Win XP and beyond
(must have Windows 2003 server toolkit shell intalled)
Code:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM found info at http://malektips.com/xp_dos_0002.html
REM Windows Server 2003 Tools shell in XP rktools.exe
REM http://technet.microsoft.com/en-au/windowsserver/bb405955.aspx
REM using toolkits shell command SLEEP
REM sleep until startup is complete
sleep 180
call c:\scripJbat\bump.bat
sleep 15
REM first the alt button
javaw -classpath "c:\scripJbat";. Mpress 50 45
sleep 5
REM open record panel
javaw -classpath "c:\scripJbat";. Mpress 50 180
sleep 10
REM press record button after waiting for sub GUI to build
javaw -classpath "c:\scripJbat";. Mpress 175 470
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Mpress Java2 class next NOTE: args 0 AND args 1 ARE NOT PROPERLY PRINTED IN THE CODE BELOW BECAUSE OF
SQUARE BRACKETS AND ARE ONLY SHOWING AS args
modified for completeness with a static convertor method.
Code:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
/* Mpress.java written by Mr S.A.Marchant June 2009 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Mpress{
static int x;
static int y;
Mpress(){}
/*
the techinally correct way to set a global variable
because of scope "use a returning method"
*/
static int mkInt(String cmmdlnStr){
// static class call to static convertor method
return Integer.parseInt(cmmdlnStr);
}//enmeth
// THE SQUARE BRACKETS AROUND THE NUMERALS FOR THE args ARRAY
// ARE NOT SHOWN HERE BECAUSE THE FORUM CGI SCRIPT DOES NOT
// ALLOW FOR THEM
//the zip containing the scripts/batches has this code in it for
// recompile or modification and is as is without warranty or guarantee
public static void main(String args )throws AWTException{
if(args.length > 1){
try{
x=mkInt(args 0 ); //Integer.parseInt(args 0 );
} catch (NumberFormatException e){
System.err.println("Argument must be an integer args-0 (first argument)");
System.exit(1);
} try{
y=mkInt(args 1 ); //Integer.parseInt(args 1 );
} catch (NumberFormatException e){
System.err.println("Argument must be an integer args-1 (second argument)");
System.exit(1);
}}
else{
System.out.println("Argument length not sufficient");
System.exit(1);
}//enif
// DEBUG OUTPUT ONLY
//System.out.println("arg0: "+args 0 );
//System.out.println("arg1: "+args 1 );
Robot rb = new Robot();
rb.mouseMove(x,y); //120,460 THIS LINE HERE CONTROLS WHERE THE BUTTON IS PUSHED X AND Y COORDS
rb.delay(1000);
rb.mousePress(InputEvent.BUTTON1_MASK);
rb.delay(1000);
rb.mouseRelease(InputEvent.BUTTON1_MASK);
}//enmain
}//enclss
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
EXECUTION BATCH CODE "wxtoim-startup.bat"
Code:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM this goes in the startup folder
REM below is exactly where the scrip folder should be and the .vbs
wscript c:\scrip\AUTO-WX-ATTEMPT.vbs
"test-run.bat" self explaining
Code:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM SOMEWHERE NEAR SCREEN MIDDLE FOR 1024 X 768
REM MIDDLR APPROX. 500 330
REM be sure there is only one space between all parts of the next
REM commandlines arguments and no spaces on the ends
REM change the two integer numbers below to change the position to test
REM where the mouse press will be when moved to then triggered
REM this batch only runs the mouse press-move class alone
javaw Mpress 150 450
pause
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
"test-run.sh" FOR LINUX self explaining
Code:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#!/bin/bash
# written by mr. Samuel A Marchant Sydney Australia 06-06-2009
# USE THIS SCRIPT BY CALLING IT ONLY FROM WITHIN THIS DIRECTORY
# (cd into this directory first) OR IT WILL NOT OPERATE
# KEEP YOUR PROMPT WINDOW AS SMALL AS POSSIBLE
# somewhere near screen middle for 1024 x 768
java Mpress 500 300
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Bit more on monitors and sleep...
..."switch off the monitor and forget about till after lunch when I go up again and look at the received pictures"...
You can set the monitor inside windows to switch off as a power saver mechanism until you hit enter or the space key.
"Display(icon)" - "screen saver"(tab) - "power"(GUI button)
See microsoft.com and search for "hibernate" and as it is you want to find "Standby"
http://www.microsoft.com/windowsxp/using/tabletpc/getstarted/standby.mspx
Stanby is the one to use.
Play with the power scheme drop down list to get an idea of how to set these.
To run a script, you will want to keep the hard drive active so select "Never" for a hard drive.
With WSH you will at least require to use, wscl.AppActivate "WXtiImg [Freeware edition]" to push
the window to the top and alert the monitor(though that may not be required if some auto record technique is used).
It seems i overshot the bit about 137 MHz reciever equipment being reasonably cheap and nasty for the purpose on
the soundcard.
Note: NEVER PUT IN A MOUSE EMULATOR PROGRAM (UNLESS YOU SERIOUSLY REQUIRE TO)
IF YOU WANT THE ROBOT AND SCRIPT TO OPERATE (IT OFTEN CHANGES KEYS AND ACTIONS AROUND).

También podría gustarte