Filemaker Using Web Viewer to build Database Navigation Menu Using Callback URLs - html

I would like to use the Filemaker web viewer to build and style a database navigation menu. I have found a handful of samples and I have played with the code but the problem that I am having is that it launches in another window (Note that I also have several versions of Filemaker on my desktop and it also tries to launch the pop up in Filemaker 13 when I am building in Filemaker 12).
The goal is to call the script inside of the current database and current application so that it functions as a system navigation menu. In straight HTML in a site environment I would add target="_blank" or target="_parent" to the href but I can't seem to get the syntax right to try it in the web viewer and I'm not sure if this would be the solution. Can any angel from tech heaven assist or offer any advice? Here is the sample code that I currently have that calls a Filemaker script in a local system for a google map interface. I'll be using the script differently but the structure will be the same.
"data:text/html," &"
<html>
<body>
<a href='"&"FMP://" &
Case(
IsEmpty(Get(HostIPAddress)); Get(SystemIPAddress);
not IsEmpty(Get(HostIPAddress)); Get(HostIPAddress);
)
&"/"& Get ( FileName )& "?script=Open-Detail-Map&param=" & Data::ID_Data&"'>View Map
Detail</a>
</body>
</html>"

This works for me, and it opens it in the same window. I'd recommend using FileMaker 13 for development, or uninstalling it. It launches in 13 because the URL protocol handler (FMP) is the same for both versions, so your OS uses the newest version of FileMaker to handle the URL call.
Note that triggering scripts using a URL will not work in standalone files in FileMaker Pro, only hosted files or FileMaker Go.

It is possible to call the script from another file directly in FileMaker, rather than trying to do it from a webviewer. Can you clarify why you're trying to create your navigation menu in a webviewer?
If a webviewer is not compulsory, I would recommend:
creating an External Data Source that points at the other file
Adding FileMaker buttons for your navigation
Right-click on the button you want to trigger the script, and choose "Button Setup", then choose "Perform a Script" and specify the script you want to run from the other file.

Honestly, this makes no real sense to do. I get what you are trying and it seems interesting, but build your navigation in FileMaker and display your banner ads in a web viewer. The other option, which is always available, is to just build out the solution as a PHP site using the FMP PHP API.

I realize that this is an answer for a rather old question, but I think it warrants pointing out what the solution here is...at least in modern versions of FileMaker. I don't recall exactly when this was fixed...13.05 or .06? It was present in earlier versions but wouldn't work for locally opened files, only hosted files; now it works in both.
You need to use the 'currently open file' reference in the FMP URL: "$". So your URL string should look like this:
"fmp://$/fileName?script=AScriptName&param=..."
In your code:
<a href='"&"FMP://" &
If ( IsEmpty(Get(HostIPAddress)); "$"; Get(HostIPAddress) )
&"/"& Get ( FileName )& "?script=Open-Detail-Map&param=" & Data::ID_Data&"'>View Map Detail</a>

Related

Can't get Hello world example to work as a web-app

I am a total newbie to google-apps-script, but I can't believe the problem I'm having. I can't even get the Hello World! example to work as a web-app.
I have copied and pasted code from google's documentation website, and I still can't get it to work. (I tried more complicated stuff first, but then I started trying simpler and simpler code until I bottomed out with the below problem.)
When I publish the following code as a web-app:
function doGet() {
return ContentService.createTextOutput('Hello, world!');
}
Instead of seeing "Hello, world!" in the browser, I get the following error message:
The script completed but did not return anything.
I'm really at a loss here. I don't know how to try anything simpler, and again, the code snippet above was copied and pasted directly from the Content Service documentation page (https://developers.google.com/apps-script/reference/content/).
Any help with this problem is greatly appreciated.
Thanks in advance.
Thanks for the response Alan.
I created a new project and pasted the Hello world code into it, and it worked. I'll just work from this new project going forward.
...
Now that I have a few more minutes of experience, I think my problem was with version control. I thought that when I made a change in my code and updated the current version, then the current version published as a web app would reflect this change in my code. However, it seems that you have to create a new version of your code in order for your newly-published web-app to reflect the most recent changes in your code. My problem was that I was not creating new versions as I changed my code, so I kept accessing the old code which was always the same as when that version was first created.
(Using the Test web app for your latest code link (located in the Deploy as web app dialog which is accessed from the Publish menu) did reflect my most recent changes, but this was not adequate for my testing purposes since I was sending arguments to my web app url. (The latest code link only calls your web app with a read-only version of your web app url that has no arguments appended to it.) In order to properly test the web app with all arguments appended to the url, I needed to re-publish the new code under a different version number in order for those changes to be reflected in the web app that was published. Only then I could access this url that pointed to my latest code with all of my arguments appended.)
Again, just hitting the Update button in the Deploy as Web App dialog without specifying a new version does not actually update the current version with your new code. In order for your latest/newest code to be deployed you have to create a new version of your code that will reflect your latest changes. In order to create a new version, you first have to choose Manage versions... from the File menu and then save a new version that reflects your most recent code changes by hitting the Save New Version button. Once you have done this, you can choose to publish this new version in the Deploy as Web App dialog. The url for your web app will then access whichever version of your code that you last deployed/published.
I know that everyone on here probably already knows this, but I thought I'd clarify what my problem was (problem understanding the work-flow of the code-publish cycle) in case any newbie in the future also runs into this problem.
<<<<<UPDATE>>>>>
See the answer from Serge below about how to use the dev version of your web app url with parameters appended to it. In many cases, this can alleviate the need to create new (exec) versions of your web app as I described above if/when you are making only incremental changes to your code.
In order to get hold of your dev url in the browser address bar so you can copy it for further use (instead of getting the script.googleusercontent.com... url that is used to temporarily serve the content/output of your web app) just call an undefined function in your web app code. Then use the Test web app for your latest code link to call the dev version of your web app. This will cause an error page to be returned, and your dev url will then be available for copying in the browser address bar.
Following these steps I was able to get the Hello World Script to run:
Go to script.google.com
Paste your above code into the script area.
Save as Hello World.
Publish as version 1.0.
Go to the url it generates and "Hello, world!" is now displayed.
You can now also test the web app with the latest code when publishing.
Your statement that the .dev url is not able to support parameters is not exactly true (The latest code link only calls your web app with a read-only version of your web app url that has no arguments appended to it). Actually it does just like the exec one but you can only call this url directly from the browser (and not from another app) because only you can access the app using this special url.
demo code :
function doGet(e) {
var valToReturn = ContentService.createTextOutput('the parameter was '+e.parameter.val).setMimeType(ContentService.MimeType.TEXT);
return valToReturn;
}
The test .dev url with parameters goes like this :
https://script.google.com/macros/s/AKfycb___vWxs/dev?val='test'
and the return you get in your Browser is :

What is the best way to add a Dart hello world into my existing Node.js website?

I have been reading tutorials and guides concerning this but have not found a straight forward answer to this.
I currently have an existing website running on a node.js platform, locally on my computer.
Goal: Now I want to try and write a simple hello world in Dart, export it to plain JavaScript and see it work in my existing website.
Reading the documents, I read that I should create a new "Web Application" and to create some sample code up and running, I check the "Generate sample content" box.
And my project is now created in Dart Editor:
I can run the sample in Dartium, see it work, etc.
But the problem is that I have now a .html file in the Dart-project, while I have a real .html file for my existing node website in a totally different path. I don't want that. I want to try and use the existing .html instead, since.. thats my real website.
But when trying to create a new Dartium launcher, I can only refer to .html files within my Dart-project:
So my big question is; How do actually start using Dart with my existing developed website?
How do I create that bridge?
On the second image above in your original question, there is an option just below the HTML file, called URL - is this what you're looking for? You can set that to any arbitrary URL.
You'd also need to copy the helloworld.dart file into your node.js server path, and copy the bits inside the <body> tag into your existing HTML page. You'll also need to copy the packages\browser\dart.js file somewhere to your node.js server, too.
If you wanted to run the JS version, you'd also need to use the editor menu option to Generate JavaScript and copy the .js files into your node.js server path.
The script tag that refers to dart.js automatically detects if the browser supports Dart natively, and will either load the .dart version of your app, or the .dart.js version of your app (from the same folder location).
So what you're likely after is something like:
c:/nodejs_server_root
/existingIndex.html // containing the two script tags from helloworld.html
// and other tags referred to in helloworld.dart
/helloworld.dart
/dart.js
/helloworld.dart.js
And in the "URL" path in the launch configuration, you'd put something like http://localhost:<port>/existingIndex.html
https://pub.dartlang.org/packages/dev_compiler can compile Dart to Node.js modules with the --modules=node option.
See also https://github.com/dart-lang/dev_compiler/issues/291#issuecomment-176687849

How to create HTML5 100% offline applications?

Sometimes I need to write a small program just to represent some data in a chart, or similar stuff. I have been wanting to do this kind of things through the browser, with HTML5. I think it would be nice to use its canvas to create a nice UI for simple apps.
I have read some articles related to offline applications with HTML5, but they focus on downloading all the data you need and save it to the cache to use it offline later. You even need to set up an Apache server (or similar) to create your app.
I don't need my app to be online, just in my computer. I just want to create a simple application, nothing to do with internet at all.
How can I do this? Is it even possible or worthy? Is there any "Hello world!" tutorial about this around there?
Something like Mozilla Prism would be good for displaying the content as an application.
There's no need to have a web server like Apache for just displaying HTML5/Javascript in a browser. You can just have it all in a folder on your desktop and then load it in the browser with the file:// protocol.
For example file://C:/Documents and Settings/YourUser/Desktop/YourApp/index.html would open an HTML file in a folder called YourApp on your user's desktop.
If you ever find you need to read static HTML+Javascript files locally then I'd recommend using this python command in the console:
python -m SimpleHTTPServer
It launches a simple HTTP server (who'd of guessed) that serves files from the current working directory. Effectively, it's the same as launching an apache webserver, putting some static assets in /var/www/... etc. etc.
You could also just browse to the assets at file:///some/folder; however, most browsers will prevent javascript from using AJAX when files are loaded in that way, which will manifest as a bunch of bugs when you go to load it.

Offline web app for distribution in pendrives (Windows only)?

We are trying to distribute a basic HTML file with some links to a PDF document in a USB drive for advertising purposes. The idea is that an autorun opens up this HTML in the default browser. However, this might not be a good idea since it would look very amateur-ish and we will have to rely on the default browser's technology (which unfortunately has a good chance on being IE6/7!)
We've explored a few alternatives, but we can't find one that really fits what we are trying to achieve:
Mozilla Prism
Altough it seems like it's designed with offline web apps in mind, the executable creates files in the user's AppData directory and it's hard to configure the default paths. Also, Firefox doesn't have a default PDF viewer, so we will have to depend on the user's default PDF viewer (which might be Adobe Reader)
Mozilla Chromeless
Since Prism is inactive, the idea is still developing with Chromeless, which allows the developer to create the browser interface with basic HTML/JS/CSS. The main issue here is that somehow the build isn't loading HTML, all that's showing is a gray iframe. I'm not sure if it's just me, because there's nothing on the issues page.
Portable App
We could throw in the portable version of Firefox or Chrome and customize the XUL for Firefox or open Chrome in app mode.
Firefox's advantage is that it kind of supports relative paths (resource://), but it doesn't have a built-in PDF viewer. Chrome has a very good and lightweight PDF viewer and the built-in app mode is a very useful feature for us, but I can't find how to open a local path without the usual absolute path (file:///C:/) since we don't know what's the drive's letter.
Has anyone figure out how to handle this kind of issues? Thanks.
This has been asked three years ago, but it's unanswered, listed high in Google, and I stumbled over the exact same problem and can imagine that many others that seek to ship portable web apps that can be run locally and with a minimum of dependencies will encounter this issue, too.
The solution I am now going with is the node-webkit.
You can treat it like a portable version of chrome, however it excepts a relative path to your app's entry point, is about 40 MB smaller, and much more customizable than the --app mode of chrome (which isn't customizable at all if I remember correctly).
Github & Download:
https://github.com/rogerwang/node-webkit#downloads
An extensive guide:
http://thejackalofjavascript.com/getting-started-with-node-webkit-apps/
My usage suggestion for Windows:
First create an app package as explained in the guide linked above
For the node-wekit to load with your app, you need to start it like this:
nw.exe app.package
Where nw.exe is in the root of the zipped folder you downloaded and app.package is a zip file (can have any name) that contains your app data and package.json.
To do this silently, you can use a BAT file containing the (amended) call above and a VBS file containing something like this:
CreateObject("Wscript.Shell").Run "cmd /c launchNW.bat", 0, true
launchNW.bat being the name of your BAT file. Now run the VBS file; a window containing your web app should pop up without the command window appearing with it.
Finish reading the linked guide to learn more about customization options to do things like hiding the browser UI etc.

Run a program from a local webpage

I'm trying to use a webpage as an entry point for a kiosk. The HTML will be run in local, I need two things:
<a href="c:\Users\Admin\Documents">...
Which works like a charm
And..
<a href="c:\Program Files\Windows Live\Mail\wlmail.exe">...
(program just an example, all programs are the same)
Which works but.. it prompts to download the file then you are prompted to start it.. Is there any way to do this directly, like click and bam you opened notepad.exe? Maybe using a Java applet?
EDIT:
I know it can't be done remotely, I'm talking about local files.
The file will be accessed as c:\myhtml.html
And will open ONLY already installed files, nothing from the web.
If i get your question right , the closest thing to get what you want would be using *.hta which is a HTML Application that runs outside the browser window just like a normal app.
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script>
Bit more info here:
http://www.kunal-chowdhury.com/2010/09/how-to-execute-local-file-using-html.html
The right way to implement this is by creating custom protocol in Windows. Details in the MSDN article "Registering an Application to a URI Scheme"
No, this is security issue, browsers don't allow it because it could be security risk to run apps without prompt, just by clicking on the link.
There are several technologies like java WebStart and ASP ClickOnce - they will install the app more or less automatically, signing the application helps too - the messages the user gets look less scary.
Correct me if I didn't understand you. If you're running the web page locally (http:\127.0.0.1) and want to execute a program in the same machine, it will depend on the technology that you're using, for example in php you could use exec() to execute a program on user input but it will run on the server side.