public class AHKScriptBuilder extends Object
Constructor and Description |
---|
AHKScriptBuilder() |
Modifier and Type | Method and Description |
---|---|
static String |
advanceLine(String str)
advances a string so its first word is flushed
|
static void |
advanceParam(FileWriter fw,
int level)
adds to the AHK script a call to AdvanceParam which gets the AHK script to move on to the next param in args list (in runtime)
|
static void |
defineAdvanceParam(FileWriter fw,
int level)
adds to the AHK script AdvanceParam function definition - this function makes the AHK script to move on to the next param in args list (in runtime)
|
static void |
defineLookupParam(FileWriter fw,
int level)
adds to the AHK script LookupParam function definition - this function checks whether a specific param is present in the script args
|
static void |
defineWin(FileWriter fw,
int level)
adds to the AHK script Win function definition - this function makes the AHK script wait for a window to show
|
static String |
findFilePath(File f,
String command) |
static void |
finishScript(String scriptName)
adds definition of used functions to the end of AHK script
|
static String |
formatToken(String prefix,
String token,
String suffix)
formats a string based on "path file" definitions, adding a prefix and a suffix
|
static String |
generateFormatJSONString(String format,
String folderName)
goes over the all "path" files to build the JSON string that defines the conversion to an output format
|
static void |
generateHeader(String scriptName,
String roadMapFolder,
String inputs,
String domain)
generates the header for the script
|
static String |
generateJSONStringRec(BufferedReader ins)
goes over a file "path" to build the JSON string based on the params defined in the file
|
static String |
generateParam(BufferedReader ins)
generates JSON string for a param (including nested params)
|
static String |
generateParameterJSONString(File f)
wraps rec function that goes over a file "path" to build the JSON string
|
static void |
generateScript(String scriptName,
File roadMapFile)
wraps calls to generateScriptRec, so optional actions may be skipped if the param was not selected
|
static void |
generateScriptRec(BufferedReader ins,
FileWriter fw,
int level,
String currWindow)
generates the AHK script
|
static void |
main(String[] args)
AHKScriptBuilder can be called from cmd line by giving 2 arguments: output AHK script directory path and input files directory path
|
static String |
nextWord(String str)
returns the next word of a string
|
static String |
prepareExtraParams(File roadMapFile)
searches for params in "path" files and adds necessary AHK code when found
|
static String |
readLine(BufferedReader br)
reads a new line from the input buffer
|
static String |
removeDoubleQuotes(String str)
removes double quotes from a string (first and last chars)
|
static void |
replaceScriptFileInfo(File[] files) |
static void |
replaceStringInScript(File f,
String old_str,
String new_str) |
static void |
scriptChoose(String line,
FileWriter fw,
int level,
String currWindow)
adds to the AHK script commands that choose an item from a dropdown menu based on the definitions in the input file
|
static void |
scriptClick(String line,
FileWriter fw,
int level,
String currWindow)
adds to the AHK script commands that click a button based on the definitions in the input file
|
static void |
scriptComment(String line,
FileWriter fw,
int level)
adds a comment to the AHK script file
|
static void |
scriptIfWin(String line,
FileWriter fw,
String currWindow,
BufferedReader ins,
int level)
not currently in use
adds functionality to AHK script to deal with window pop ups that may or may not appear
|
static void |
scriptInputParam(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds a new param to the AHK script
|
static void |
scriptInsert(String line,
FileWriter fw,
int level,
String currWindow)
adds to the AHK script commands that insert text into an "edit box" based on the definitions in the input file
|
static void |
scriptMenu(String line,
FileWriter fw,
int level,
String currWindow)
adds to the AHK script commands that choose a menu item based on the definitions in the input file
|
static void |
scriptParamButton(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds to the AHK script commands that click (or not) a button according to the param selection
|
static void |
scriptParamCheckbox(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds to the AHK script commands that check/unchek a checkbox according to the param selection
|
static void |
scriptParamDropdownMenu(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds to the AHK script commands that choose an item of a dropdown menu according to the param selection
|
static void |
scriptParamMenu(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds to the AHK script commands that choose an item of a menu according to the param selection
|
static void |
scriptParamSaveText(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds a "save text" command to the AHK script that will be executed if the param is selected
|
static void |
scriptParamScroll(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds to the AHK script commands that move a scrollbar according to the param selection
|
static void |
scriptParamUserInput(String line,
FileWriter fw,
BufferedReader ins,
int level,
String currWindow)
adds to the AHK script commands that insert text into an "edit box" according to the param selection
|
static void |
scriptRun(String line,
FileWriter fw,
int level)
adds all initial info to AHK script
|
static void |
scriptSaveText(String line,
FileWriter fw,
int level,
String currWindow)
adds to the AHK script commands that saves text to a file based on the definitions in the input file
|
static void |
scriptScrollbar(String line,
FileWriter fw,
int level,
String currWindow)
adds to the AHK script commands that move a scrollbar based on the definitions in the input file
|
static void |
scriptSelect(String line,
FileWriter fw,
int level,
String currWindow)
adds to the AHK script commands that check/uncheck a checkbox based on the definitions in the input file
|
static void |
scriptWait(String line,
FileWriter fw,
int level,
String currWindow)
adds AHK commands that create a "wait" in the AHK script execution
|
static String |
scriptWin(String line,
FileWriter fw,
int level)
adds to the AHK script a call to Win() which will (in runtime) wait for a window and show it
|
static void |
scriptWrite(String line,
FileWriter fw,
int level)
adds text to the AHK script file
|
static void |
softwareWriteAllScripts(String swRoadMapDirectory,
String scriptDirectory) |
static void |
startScript(String scriptName,
File f)
wrap call to scriptRun
|
static void |
writeScript(String scriptName,
String roadMapFolder)
loops over all input files to build the script - it assumes that the file #0 will have the "run" command
|
public static void main(String[] args)
public static void softwareWriteAllScripts(String swRoadMapDirectory, String scriptDirectory)
public static void replaceStringInScript(File f, String old_str, String new_str)
public static void replaceScriptFileInfo(File[] files)
public static void writeScript(String scriptName, String roadMapFolder)
scriptName
- name of output AHK scriptroadMapFolder
- input directorypublic static void generateHeader(String scriptName, String roadMapFolder, String inputs, String domain)
scriptName
- name of output AHK scriptroadMapFolder
- the directory where the "path" files can be foundpublic static void startScript(String scriptName, File f)
scriptName
- name of output AHK scriptf
- file with necessary RUN informationpublic static void scriptRun(String line, FileWriter fw, int level)
line
- contains the SW name and pathfw
- file writerpublic static void finishScript(String scriptName)
scriptName
- name of output AHK scriptpublic static String prepareExtraParams(File roadMapFile)
roadMapFile
- name of file being searchedpublic static void generateScript(String scriptName, File roadMapFile)
scriptName
- name of output AHK scriptroadMapFile
- name of file being processedpublic static void generateScriptRec(BufferedReader ins, FileWriter fw, int level, String currWindow)
ins
- the input bufferfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptWait(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptInputParam(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptParamSaveText(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptParamDropdownMenu(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptParamCheckbox(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptParamScroll(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptParamUserInput(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptParamButton(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptParamMenu(String line, FileWriter fw, BufferedReader ins, int level, String currWindow)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static String scriptWin(String line, FileWriter fw, int level)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filepublic static void defineWin(FileWriter fw, int level)
fw
- the file writerlevel
- nesting level for organized indentation of output filepublic static void defineLookupParam(FileWriter fw, int level)
fw
- the file writerlevel
- nesting level for organized indentation of output filepublic static void advanceParam(FileWriter fw, int level)
fw
- the file writerlevel
- nesting level for organized indentation of output filepublic static void defineAdvanceParam(FileWriter fw, int level)
fw
- the file writerlevel
- nesting level for organized indentation of output filepublic static void scriptIfWin(String line, FileWriter fw, String currWindow, BufferedReader ins, int level)
line
- contains command detailsfw
- the file writerins
- input bufferlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptScrollbar(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptChoose(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptMenu(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptClick(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptSaveText(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptInsert(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static void scriptSelect(String line, FileWriter fw, int level, String currWindow)
line
- contains command detailsfw
- the file writerlevel
- nesting level for organized indentation of output filecurrWindow
- the window description to be added to AHK commandpublic static String generateFormatJSONString(String format, String folderName)
format
- the conversion output formatfolderName
- the directory that contains the "path" filespublic static String generateParameterJSONString(File f)
f
- a "path" filepublic static String generateJSONStringRec(BufferedReader ins)
ins
- input bufferpublic static String generateParam(BufferedReader ins)
ins
- input bufferpublic static void scriptWrite(String line, FileWriter fw, int level)
line
- contains the text to be addedfw
- the file writerlevel
- nesting level for organized indentation of output filepublic static void scriptComment(String line, FileWriter fw, int level)
line
- contains the comment to be addedfw
- the file writerlevel
- nesting level for organized indentation of output filepublic static String removeDoubleQuotes(String str)
str
- string to be processedpublic static String nextWord(String str)
str
- string to be processedpublic static String advanceLine(String str)
str
- string to be processedpublic static String formatToken(String prefix, String token, String suffix)
prefix
- prefix to be added to stringtoken
- string to be processedsuffix
- suffix to be added to stringpublic static String readLine(BufferedReader br)
br
- input bufferCopyright © 2014. All rights reserved.