The WordPadOpen class creates a file name based on the calling script, then opens a WordPad document under that name. The callWordPadOpen class is a test of how the first would be instantiated in a number of other scripts (all separate files). I keep getting an error on the line "String opened = WordPadOpen.openFName();" (in the callWordPad class) that says "method openFName() from the type WordPadOpen is not static." But I can't see any reason why it would need to be, and if I make it, then all the calls inside it to things like "documentWordPadwindow" and "comboBox" complain that they need to be static, but they are from a recorded script that is not supposed to be changed. How do I fix it?
CODE
package Components;
import resources.Components.WordPadOpenHelper;
import java.util.*;//for GregorianCalendar
import java.text.*;//for GregorianCalendar
// @author Steve
public class WordPadOpen extends WordPadOpenHelper
{
Date today;
String result;
SimpleDateFormat formatter;
public void testMain(Object[] args)
{
try
{
openFName();
}// end try
catch (Exception e)
{
logError("Exception thrown from WordPadOpen.class");
}// end catch
}// end testMain
public String openFName()
{
Locale oToday = null;
boolean bExist = true;
boolean bWPExists = true;
Date today;
String result;
SimpleDateFormat formatter;
/* Blocked out by Emily 5/8/08 - next block of code performs similarly
for (int i = 0; i < args.length; ++i)
{
System.out.println( " arg["+i+"] = "+args[i]);
}
System.out.println(args[0]);
System.out.println("Passed data array is "+args[0]);
*/
String[] fName = new String[2];
fName[0] = getTopScriptName();
fName[1] = Integer.toString(getTopScriptLineNumber());
for (int i = 0; i < fName.length; i++) {
System.out.println(fName[i]);
}
logInfo(fName[0]);
do
{
bWPExists = documentWordPadwindow().exists();
if (bWPExists == true)
{
logInfo("Closed open WordPads");
callScript("WordPadClose");
}// end if
else
{
bWPExists = false;
//logInfo("Did not detect macro pop-up");
}// end else
}// end do
while(bWPExists == true);// end do while
shellExecute("wordpad.exe");
sleep(1);
//tFrame().inputKeys("%{PRTSC}");
//documentWordPadwindow(ANY,MAY_EXIT).inputKeys("^v");
documentWordPadwindow(ANY,MAY_EXIT).inputKeys("^s");
oToday = new Locale("en", "US");
formatter = new SimpleDateFormat("yyyy.MMM.dd.kk.mm", oToday);//, currentLocale // EEE d MMM yy
today = new Date();
result = formatter.format(today);
//System.out.println("Locale: " + oToday.toString());
//System.out.println("Result: " + result);
//logInfo("Locale: " + oToday.toString());
logInfo("Result: " + result); //}
// logInfo("Script name is " + sTSN +" from line number " + iSLN);
// saveAswindow().inputChars(iSLN + sTSN +" "+ result +".rtf");
logInfo("Script name is "+fName[0]+" from line number "+fName[1]);
//saveAswindow().inputChars(fName[0]+" "+" "+result+".rtf");
saveAswindow().inputChars(fName[0]+" "+" "+result+".doc");
desktopbutton().click(atPoint(32,56));
// Window: wordpad.exe: Save As
comboBoxcomboBox2().click(ARROW);
comboBoxcomboBox2().click(atPoint(185,7));
saveAswindow().inputChars(".");
savebutton().click(atPoint(39,16));
return fName[0];
}// end openFName
}// end class WordPadOpen
package Components;
import resources.Components.callWordPadOpenHelper;
import Components.WordPadOpen;
public class callWordPadOpen extends callWordPadOpenHelper
{
public void testMain(Object[] args)
{
String opened = WordPadOpen.openFName();
System.out.println("Opened the file " + opened);
logInfo("Opened file " + opened);
}
}// end class callWordPadOpen