C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe chrome://flags chrome://about
chrome.exe -incognito --app=google.com chrome.exe -incognito --new-window mytargetpage.com "c:\progra~2\Google\Chrome\Application\chrome.exe" --chrome-frame --kiosk http://foldoc.org/pub/misc/automata.html "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=XXXXXXXXXX --window-size=800,600 --window-position=580,240 --app="http://www.google.com/" or "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --chrome-frame --window-size=800,600 --window-position=580,240 --app="http://www.google.com/" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Default" --app="data:text/html,<html><body><script>window.moveTo(580,240);window.resizeTo(800,600);window.location='http://www.test.de';</script></body></html>" --window-size=w,h google-chrome "data:text/html;charset=ISO-8859-1,<html><head></head><body> <button onclick=\"javascript:window.open( 'http://perso.f-hauri.ch/~felix/svg/dustin_w_Clock_autonom.svg', 'clock','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,' +'resizable=1,width=600,height=600,top=100,left=120');\"> clock </button>" give a nice way to do this. Nota: This work as well with firefox too.
I'm not aware of a way to read command line params, but you can pass a URL to Chrome on the command line, and you can detect that URL being loaded. So a hack would be to call
chrome.exe http://fakeurl.com/?all-the-data-you-need-to-pass
and have your extension redirect this URL to the new tab page and then act according to the data in the querystring.
If you’re comfortable with the command line, you can also change Chrome’s behavior by launching it with command line flags. For example, the command below launches Chromium (the open-source version of Chrome) and tells it to cycle through the list of URLs in the specified text file, then exit:
/Applications/Chromium.app/Contents/MacOS/Chromium --visit-urls=/Users/cantrell/tmp/urls.txt
> chrome <- "C:/Program Files (x86)/Google/Chrome/Application/Chrome.exe" > args <- c("http://vlado.fmf.uni-lj.si", + "-incognito", + "--app=google.com", + "--window-size=500,300" ) > system2(chrome,invisible=TRUE,wait=FALSE,args=args)
ERgraphJS.R
setwd("C:/Users/batagelj/work/Python/graph/SVG") dice <- function(n=6){return(1+trunc(n*runif(1,0,1)))} ErdosRenyiNet <- # generates a random undirected graph of Erdos-Renyi type # with n vertices and m edges, and stores it on the file # fnet in netJSON format. # Example: ErdosRenyiNet('testER.net',100,175) # ------------------------------------------------------- # by Vladimir Batagelj, R version: Ljubljana, 20. Dec 2004 # based on ALG.2 from: V. Batagelj, U. Brandes: # Efficient generation of large random networks # Addapted for netJSON by V. Batagelj, Piran, 4. Jul 2016 function(fnet,n,m){ net <- file(fnet,"w"); head <- paste('graph = {\n "netJSON": "basic",\n', ' "info":{"network": "ERgraph",', '"org": 0, "nNodes": ', n, ', "nEdges": ', m, ', "meta" : { "date": "July 4, 2016" }},\n "nodes": [',sep='') cat(head,file=net) for (i in 1:n) cat(' {"id": ',i-1,',"name": "v',i-1,'", "group": ',dice(6), '}', ifelse(i==n,'',','),'\n',sep='',file=net) cat(' ],\n "links": [',file=net); L <- new.env(parent = baseenv()) for (i in 1:m){ repeat { u <- dice(n)-1; v <- dice(n)-1 if (u!=v) { edge <- if (u<v) paste(u,v) else paste(v,u) if (!exists(edge,env=L,inherits=FALSE)) break } } assign(edge,0,env=L); cat(' {"source": ',u,', "target": ',v,', "value": ',dice(9),'}', ifelse(i==m,'',','),'\n',sep='',file=net) } cat(']}',file=net); close(net) } ErdosRenyiNet('ERgraph.js',30,45)
forceNet.js
function forceNet(V,L){ // addapted from // Mike Bostock’s Block: Force-Directed Graph // http://bl.ocks.org/mbostock/4062045 var color = d3.scale.category20(); var force = d3.layout.force() .charge(-120) .linkDistance(30) .size([width, height]); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); force .nodes(V) .links(L) .start(); var link = svg.selectAll(".link") .data(L) .enter().append("line") .attr("class", "link") .style("stroke-width", function(d) { return Math.sqrt(d.value); }); var node = svg.selectAll(".node") .data(V) .enter().append("circle") .attr("class", "node") .attr("r", 5) .style("fill", function(d) { return color(d.group); }) .call(force.drag); node.append("title") .text(function(d) { return d.name; }); force.on("tick", function() { link.attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }); node.attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }); }); };
ForceJS.html
<!DOCTYPE html> <meta charset="utf-8"> <style> .node { stroke: #fff; stroke-width: 1.5px;} .link { stroke: #999; stroke-opacity: .6;} </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script src="./Ergraph.js"></script> <script src="./forceNet.js"></script> <script> // set up the drawing area var width = 600, height = 400; var OK = forceNet(graph.nodes,graph.links); </script> </body> </html>
chrome <- "C:/Program Files (x86)/Google/Chrome/Application/Chrome.exe" args <- c("C:/Users/batagelj/work/Python/graph/SVG/ForceJS.html", "-incognito", "--app=google.com", "--window-size=500,300" ) system2(chrome,invisible=TRUE,wait=FALSE,args=args)
readForce.html
<!DOCTYPE html> <head> <meta charset="utf-8"> <style> .node { stroke: #fff; stroke-width: 1.5px;} .link { stroke: #999; stroke-opacity: .6;} </style> <script src="http://d3js.org/d3.v3.min.js"></script> <!-- script src="./d3/d3.js"></script --> <script src="./forceNet.js"></script> </head> <body> <input type='file' accept='.json' onchange='openFile(event)'> <script> function process(graph) { // set up the drawing area // width = graph.info.width; height = graph.info.height; s = graph.info.org; width = 500; height = 500; s = 0; var OK = forceNet(graph.nodes,graph.links); } var openFile = function(event) { var input = event.target; var reader = new FileReader(); reader.onload = function(){ process(JSON.parse(reader.result)); }; reader.readAsText(input.files[0]); }; </script> </body>