function RunLastCommand(){ var i = 0; try { i = fw.historyPalette.getStepCount(); }catch (e) { alert("No commands are available for replay in your History."); return; } var currentScriptEsc = escape(fw.currentScriptFileName); var step; while (i--) { step = fw.historyPalette.getStepsAsJavaScript([i]); if (step.indexOf('fw.runScript') == 0 && step.indexOf(currentScriptEsc) == -1 && step.indexOf(fw.currentScriptFileName) == -1) { return fw.historyPalette.replaySteps([i]); } } alert("No commands are available for replay in your History."); } RunLastCommand();