In other words, launching the preview as a hyperlink rather than as a file.
Either way, you've done a great job with this little editor. I think it's brilliant and use it all the time for .xql and .lzx (I simply open my browser to the page and refresh each time I want to preview results)
Cheers,
Peter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<For example, C:\tomcat\webapps\openlaszlo\test.lzx doesn't preview because windows doesn't recognize lzx as a file type.>
I may well be overlooking something here, but is this an extension problem? If so, I could use a temporary file, give it an .html extension and open that. Could you try creating a copy with an additional html extension and see if that will open correctly? If it works, this would be a very quick solution for all kinds of files.
<for example, on my machine at least, xqueries (.xql) would default to http://localhost:8080/exist/ while open laszlo (.lzx) would default to http://localhost:8080/openlaszlo/ etc... >
If the extension change doesn't work, I will look into this as an alternative.
Cheers,
Gerald
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking at the XML Copy Editor GUI I think this can be achieved through a proxy app, so that instead of launching a browser directly (passing the file path as argument to browser), a proxy *.bat or *.exe is used to receive the filepath, map to the approriate serve path, and only then launch the browser.
Better still, if under Tools > Options > General there was an additional field, custom tools (proxy *.bat or *exe scripts) can extend XML Copy Editor features (as in editors like EditPlus).
In fact this can be done now, with no change to Tools design, if the Browser field points to a proxy tool instead of the browser path.
Using a proxy tool is better, since *lzx files will need the prefix, but also query arguments to be added at end of *.lzx extension. eg. to compile in different modes
So the filename.lzx needs to be wrapped by both prefix and suffix scripts.
d~l
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(b) Create a folder named tools in c:\Program Files\XML Copy Editor\
(c) Compile scripts (extension *.ahk) to place in tools folder
(d) This example script launches the file in Firefox
;==========================================
MsgBox, 4, , Would you like to continue?
IfMsgBox, No
return
; Otherwise, the user picked yes.
MsgBox You pressed YES.
MsgBox %1% ; filepath argument passed out from XML Copy Editor
(f) Compile proxy.ahk script to proxy.exe using the Ahk2exe tool.
(g) Point the browser field to the new custom tool .. proxy.exe
(h) Click on Browser button in XML Copy Editor and proxy.exe will then launch *.lzx file in tomcat / Firefox.
....
Now this is a basic example; but using autohotkeys you can build a menu based GUI which selects different browser path (IE, Firefox, Opera) or adds query arguments to the urlpath.
Here is reference to command line arguments which can be used in Firefox ..
Thanks d~l, that's really useful! I must admit I've never used ahk, but it looks like a very useful tool (I tend to use C/C++ because it's familiar and always available).
What strikes me is that this will work very well with the upcoming command interface. It may not then be necessary to save tools in the application folder. If a tool is known to the system (and the exe is in a folder visible to the system) you could simply have a custom command "proxy $(FilePath)" and it should work fine.
I must speed up work on this as it shouldn't take too long to do.
Thanks again,
Gerald
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks d~l. ahk really does look great for writing Windows tools. My only concern is that it isn't cross-platform, which means that I'd need to implement everything again for the Linux and any future ports (Mac OSX is top of my wish list).
One thing that your example has shown me is that the command interface will need more than just a $(FilePath) variable: it needs $(Path), $(FileName), $(Extension) etc. as well. (Fortunately all that is easy to do in a cross-platform way, so I really really must get down to it!)
-Gerald
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Gerald,
At the moment the browser preview (ctrl-b) opens a file using its windows path, which is fine for XML but doesn't work for other types of files.
For example, C:\tomcat\webapps\openlaszlo\test.lzx doesn't preview because windows doesn't recognize lzx as a file type.
Is there any way to add the option (perhaps under Tools - Options) to have a default preview HTTP folder for each file type?
for example, on my machine at least, xqueries (.xql) would default to http://localhost:8080/exist/ while open laszlo (.lzx) would default to http://localhost:8080/openlaszlo/ etc...
In other words, launching the preview as a hyperlink rather than as a file.
Either way, you've done a great job with this little editor. I think it's brilliant and use it all the time for .xql and .lzx (I simply open my browser to the page and refresh each time I want to preview results)
Cheers,
Peter
Oh... and maybe a button on the tool bar to activate the preview :)
<For example, C:\tomcat\webapps\openlaszlo\test.lzx doesn't preview because windows doesn't recognize lzx as a file type.>
I may well be overlooking something here, but is this an extension problem? If so, I could use a temporary file, give it an .html extension and open that. Could you try creating a copy with an additional html extension and see if that will open correctly? If it works, this would be a very quick solution for all kinds of files.
<for example, on my machine at least, xqueries (.xql) would default to http://localhost:8080/exist/ while open laszlo (.lzx) would default to http://localhost:8080/openlaszlo/ etc... >
If the extension change doesn't work, I will look into this as an alternative.
Cheers,
Gerald
Coming at this as an OpenLaszlo developer ..
the problem is that the file path passed to the browser is typically ..
file:///c:/apache-tomcat-5.5.20/webapps/openlaszlo-3.3.3/my-apps/test.lzx
whereas, to launch an lzx extension as a server application it should be ..
http://localhost:8080/openlaszlo-3.3.3/my-apps/test.lzx
Now in other editors this is achieved by mapping ..
http://localhost:8080/
to
file:///c:/apache-tomcat-5.5.20/webapps/
...
and there might be several server paths to choose to map ...
e.g.
http://localhost:80 .... perhaps apache/php server
http://localhost:8080 .... perhaps tomcat server
...
Looking at the XML Copy Editor GUI I think this can be achieved through a proxy app, so that instead of launching a browser directly (passing the file path as argument to browser), a proxy *.bat or *.exe is used to receive the filepath, map to the approriate serve path, and only then launch the browser.
Better still, if under Tools > Options > General there was an additional field, custom tools (proxy *.bat or *exe scripts) can extend XML Copy Editor features (as in editors like EditPlus).
So you would have ...
Application Directory
C:\Program Files\XML Copy Editor
Browser
C:\Program Files\Mozilla Firefox\firefox.exe
Custom Tools
C:\Program Files\XML Copy Editor\tools\launch_in_tomcat.bat
C:\Program Files\XML Copy Editor\tools\launch_in_apache.bat
...
...
In fact this can be done now, with no change to Tools design, if the Browser field points to a proxy tool instead of the browser path.
Using a proxy tool is better, since *lzx files will need the prefix, but also query arguments to be added at end of *.lzx extension. eg. to compile in different modes
So the filename.lzx needs to be wrapped by both prefix and suffix scripts.
d~l
Thanks for your message; that's really helpful.
Do you think it would be ok to try the *.bat file approach until the generic command functionality (see feature requests) is in place?
-Gerald
Calling a simple test proxy.bat appears not to work .. the DOS command window flashes up and disappears ..
@ECHO ON
ECHO calling proxy.bat
ECHO %1
ECHO %2
ECHO %3
PAUSE
CLS
EXIT
What is the exact command line syntax passed out to browser (or in this case passed to proxy.bat)?
d~l
I have figured out how to add custom tools to XML Copy Editor .
e.g. launch file in tomcat server in Firefox
...
(a) Download and install http://www.autohotkeys.com
(b) Create a folder named tools in c:\Program Files\XML Copy Editor\
(c) Compile scripts (extension *.ahk) to place in tools folder
(d) This example script launches the file in Firefox
;==========================================
MsgBox, 4, , Would you like to continue?
IfMsgBox, No
return
; Otherwise, the user picked yes.
MsgBox You pressed YES.
MsgBox %1% ; filepath argument passed out from XML Copy Editor
browserpath1 = "c:\Program Files\Mozilla Firefox\firefox.exe"
browserpath2 = "c:\Program Files\Internet Explorer\iexplore.exe"
filepath = %1%
urlpath1 = ""
urlpath2 = ""
urlpath3 = ""
StringReplace urlpath1, filepath, c:\apache-tomcat-5.5.20\webapps, "http://localhost:8080
StringReplace urlpath2, urlpath1, \, /, all
StringReplace urlpath3, urlpath2, .lzx, .lzx"
; urlpath3 is now in quotes
MsgBox %browserpath1% %urlpath3%
Run %browserpath1% %urlpath3%
;==========================================
(e) Name this script proxy.ahk
(f) Compile proxy.ahk script to proxy.exe using the Ahk2exe tool.
(g) Point the browser field to the new custom tool .. proxy.exe
(h) Click on Browser button in XML Copy Editor and proxy.exe will then launch *.lzx file in tomcat / Firefox.
....
Now this is a basic example; but using autohotkeys you can build a menu based GUI which selects different browser path (IE, Firefox, Opera) or adds query arguments to the urlpath.
Here is reference to command line arguments which can be used in Firefox ..
http://kb.mozillazine.org/Command_line_arguments
d~l
Thanks d~l, that's really useful! I must admit I've never used ahk, but it looks like a very useful tool (I tend to use C/C++ because it's familiar and always available).
What strikes me is that this will work very well with the upcoming command interface. It may not then be necessary to save tools in the application folder. If a tool is known to the system (and the exe is in a folder visible to the system) you could simply have a custom command "proxy $(FilePath)" and it should work fine.
I must speed up work on this as it shouldn't take too long to do.
Thanks again,
Gerald
Correction to the autohotkey link I posted earlier ..
should be this http://www.autohotkey.com/
d~l
Thanks d~l. ahk really does look great for writing Windows tools. My only concern is that it isn't cross-platform, which means that I'd need to implement everything again for the Linux and any future ports (Mac OSX is top of my wish list).
One thing that your example has shown me is that the command interface will need more than just a $(FilePath) variable: it needs $(Path), $(FileName), $(Extension) etc. as well. (Fortunately all that is easy to do in a cross-platform way, so I really really must get down to it!)
-Gerald