I found an old entry asking this question, but did not find an answer for it. The script button does not take the stroke color and fill color specified for it. Similar situation with Check Mark field. In contrast, Text and Number fields do. See attached figure.
Can this be fixed sometime?
Thanks.
Attachments:
You must be
logged in to view attached files.
Reading the description for Categories, it looks to me that this is just a feature to better visualize forms and it is not a hierarchical component. Specially for your case, it would be helpful to have something like form.category to check which category the form belongs to. There is currently no API to support categories. Maybe something @brendan might in the future.
Instead of using the formId, you might just use a custom field where you store the category. If it is just for a few forms, that’s not a lot of work and you can hide the field in order not the clutter the UI.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
Can you post your script?
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
I have followed the instructions for using Utils.addToCalendar, but something is not working.
The console output for the line console.log(event_info) is “undefined”.
I tried using a script field and a form script, with the same outcome.
I am running MacOS 11.3.1 , in case it matters.
Is this function still available? What may I be doing wrong?
Thanks in advance for any pointers.
I have a requirement for which I plan to write a form level script. It is my first Tap Forms script although I have used Javascript extensively in the past.
My project requires that the script process multiple records from different forms within a document.
However, I have encountered a problem which I cannot see a simple solution to.
To explain; I have created a document that contains three categories. Within each category I have created forms where the name is the same in each category. I then have a form which I have created to hold the script that I can run once to process content in each of the forms for each category.
An example the Hierarchy would be:
Document:–Music
Category:—-Classical
Form:———-Artists
Form:———-Titles
Category:—-Classical
Form:———-Artists
Form:———-Titles
Category:—-Uncategorized
Form:———-Common script container.
I have written a simple ‘hello world’ form level script that I have placed in the ‘Common script container’. This script iterates over each form in the document and displays the form name with a list of its fields.
My problem is that I can’t find a way of differentiating the category when I list off the form names. I realise that I could create my own Category field but it seems that there should be a way of retrieving the category for the form via a function call but I just can’t seem to find anything in the documentation I have seen. I guess I could hard code the form Id to reference existing forms but how can I create a form in a specific Category using the ‘create New Form Named’ function.
Am I missing something?
Good point Sam, however I’m not using links, only the default form, and almost no scripts.
If you’ve got a lot of links, each link is also a record for the purposes of sync (in addition to forms, fields, layouts, layout items, searches, scripts, categories, table rows and records being records for the purposes of sync). I have some documents that have more links than records in them :D
It looks like NSImageEXIFData is only available on macOS.
I actually already have code to fetch the EXIF data from an image at a URL:
+ (NSDictionary *)getExifDataFromImageUrl:(NSURL *)url {
NSDictionary *exifData = nil;
CGImageSourceRef mySourceRef = CGImageSourceCreateWithURL((__bridge CFURLRef)url, NULL);
if (mySourceRef != NULL) {
NSDictionary *myMetadata = (__bridge NSDictionary *)CGImageSourceCopyPropertiesAtIndex(mySourceRef,0,NULL);
exifData = [myMetadata objectForKey:(NSString *)kCGImagePropertyExifDictionary];
}
return exifData;
}
Perhaps I could expose it to the scripting engine.
I use this method to get the photo’s timestamp so when you export the photos, Tap Forms can set the file’s creation date to the photo’s original date/time value.
If there isn’t a need to do write access, read only access via the scripting API might make sense. Potentially something wrapping NSImageEXIFData might be interesting: https://developer.apple.com/documentation/appkit/nsimageexifdata?language=objc
I tried last night to see if I could use a native JS implementation to do something with the data but couldn’t figure out a way to get to the image attachment from JS. I then tried to download via Utils.getDataFromUrl() but couldn’t bridge the gap with the JS EXIF library I picked up.
One way of using tapformz:// is calling a TapForm script from an external application. This is document in https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api under the paragraph “Calling a script from a URL”.
Another use is to open a record. On the desktop, Copy Record Link in the Edit menu copies the URL needed to the clipboard. It has the form :tapformz://record/view/db-xxx/frm-xxx/rec-xxx.
On mobile, when you show a record, click on the menu on the top right, select Copy Record Link.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
I think you should learn some JavaScript as well, you’ve already started the journey, it’d be a shame to end it here! You started off in your OP not confident you could do it though now you end it with a bona fide Tap Forms bug under your belt and your first successful script!
Humble Bundle are currently doing a sale on O’Reilly’s Head First series which includes their Head First JavaScript book along side a bunch of other books. Head First has a slightly different approach in their books and the bundle level to get the JavaScript book is $10. That book, like most Javascript resources, focuses on Javascript in web development but a lot of the language features and functionality apply to Javascript in Tap Forms as well. Also at the $10 tier is their Learn to Code book which uses Python as an introduction language and might also be helpful in learning how to code. Each programming language has their own quirks which is the fun part in writing code.
Thanks for the clearance, I’ve added it to my backlog to add to the channel.
I’m glad I added scripting then Daniel! :)
Hi Dirk, welcome to scripting! Without scripting, I wouldn’t be a TapForms user!
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
Hello Brendan, hello Sam,
after a week in the test with folder alias and Script Folder Access, both ways come to problems. In both cases it seems to be a bug.
1. The way over the folder alias (Brendan)
In Tap Forms, I double-click on the alias to get to the Finder folder. In case of creating a new subfolder or changing the name of an existing one in finder, I then have two aliases in Tap Forms of which the lower only works. So I always have to delete an alias after such an action.
In case of creating a new subfolder without using the alias before, every works fine. But than I have to search for the folder manually.
2. The way over the URL (SAM) – my preferred way
If the Script Folder Access is set once, it works fine as described last week. As soon as I restart Tap Forms, it doesn’t work anymore. I first have to define the Script Folder Access again in the preferences.
Would be nice to get this working because it’s very important to me. There are a lot of files I don’t want to sync to iOS. So it would be nice to get to finder with one click (URL) ore with double-click (alias) and without errors.
Thanks a lot for your help.