Groovy script to auto open an browser based on folder change (same as the last example on https://gist.github.com/DinisCruz-Dev/9214909/ but on a separate gist so that it embeds ok in a blog post)
- Groovy Script To Auto Generate A Key Generator
- Groovy Script Syntax
- Groovy Script To Auto Generate A Key Free
Overview In addition to the settings field configuration for Internal Web Checks, you can also execute your check using a Groovy script to collect and process HTTP data. Scripted Web Checks tend to be more flexible and are particularly useful for sites that use form-based authentication with dynamic tokens. Web Checks that are executed via Continued. You type a Groovy script in the input area. When you select Run from the Actions menu, the console compiles the script and runs it. Anything that would normally be printed on System.out is printed in the output area. If the script returns a non-null result, that result is printed.
1. Groovy script to auto open an browser based on folder change.groovy
importjava.nio.file.*; |
importcom.sun.nio.file.* |
importjava.nio.file.attribute.*; |
def editorTitle ='index.html' |
def refreshBrowser = { path-> |
eclipse.log('Opening browser with: '+ path); |
def view = eclipse.views.create('Synced WebBrowser'); |
if (view.controls().size() 0) |
view.add.browser(); |
view.controls().first().open(path); |
}; |
def startWatch = { file-> |
def filePath = file.toString(); |
def folder = file.getParent(); |
def path_Root =Paths.get(folder); |
refreshBrowser(filePath); |
def watchService =FileSystems.getDefault().newWatchService(); |
path_Root.register(watchService, (WatchEvent.Kind[] )[StandardWatchEventKinds.ENTRY_MODIFY], SensitivityWatchEventModifier.HIGH); |
Files.walkFileTree(path_Root, newSimpleFileVisitor<Path>() |
{ |
publicFileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throwsIOException |
{ |
dir.register(watchService, (WatchEvent.Kind[] )[StandardWatchEventKinds.ENTRY_MODIFY], SensitivityWatchEventModifier.HIGH); |
returnFileVisitResult.CONTINUE; |
} |
}); |
while(true) |
{ |
eclipse.log('About to start watching folder: '+ folder); |
def key = watchService.take(); |
eclipse.log('After .take()'); |
for (defevent : key.pollEvents()) |
{ |
eclipse.log(' event: '+ event.kind()); |
} |
refreshBrowser(filePath); |
key.reset() |
} |
return key; |
} |
def editor = eclipse.editors.get(editorTitle).getEditor(true); |
def file = editor.getEditorInput().getPath().toFile(); |
startWatch(file); |
//Config:UIThread_False |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Groovy Script To Auto Generate A Key Generator
- Mar 04, 2019 Using MarkupBuilder to generate html markup in groovy - htmlmarkup.groovy.
- Automate APIs with Groovy Script Document ID: 119011 Contributed by Tony Pina, Cisco TAC Engineer. Jun 22, 2015 Contents Introduction Create a soapUI Project Create a soapUI API Request Create a soapUI Test Case Introduction This document describes how to create a soapUI Application Programmers Interface (API) request and how to.
- Groovy Tutorial
Groovy Script Syntax
- Groovy Useful Resources
- Selected Reading
Groovy is an object oriented language which is based on Java platform. Groovy 1.0 was released in January 2, 2007 with Groovy 2.4 as the current major release. Groovy is distributed via the Apache License v 2.0. In this tutorial, we would explain all the fundamentals of Groovy and how to put it into practice.
This tutorial is going to be extremely useful for all those software professionals who would like to learn the basics of Groovy programming.
Groovy Script To Auto Generate A Key Free
Before proceeding with this tutorial, you should have some hands-on experience of Java or any other object-oriented programming language. No Groovy experience is assumed.