Tap Forms app icon half
Tap Forms Forum text image
Blue gradient background

Exchange tips and ideas with the Tap Forms community

Search Results for 'script'

Viewing 15 results - 721 through 735 (of 2,951 total)
  • Author
    Search Results
  • #48284
    Daniel Leu
    Participant

    I got it working with following code, but using while() is not really elegant and just consumes CPU cycles

    function sleep(delay) {
        var start = new Date().getTime();
        while (new Date().getTime() < start + delay);
    }
    
    function Add_To_Clipboard() {
    
    	Utils.copyTextToClipboard("one");
    	sleep(200);
    	Utils.copyTextToClipboard("two");
    	sleep(200);
    	Utils.copyTextToClipboard("three");
    	sleep(200);
    	Utils.copyTextToClipboard("four");
    }
    
    Add_To_Clipboard();

    When I use sleep(100), not all copies are recored. So the delay might depend on the performance of the target computer.

    Re: Javascript, there is setTimeout(), but that’s part of DOM and not ECMAScript. Feature request: add Utils.setTimeout() and maybe Utils.clearTimeout() too. Then I could do

    function sleep(ms) {
      return new Promise(resolve => setTimeout(resolve, ms));
    }
    
    for (let i = 0; i < 5; i ++) {
      if (i === 3)
        await sleep(2000);
      console.log(i);
    }
    • This reply was modified 2 years, 11 months ago by Daniel Leu.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #48283
    Brendan
    Keymaster

    I just put a sleep(2) or something like that in my Objective-C code just for testing purposes. I took it out already. Maybe there’s something similar with JavaScript.

    #48278
    Chris Ju
    Participant

    Did you put an artificial delay in java script or in the code of TF?

    For the first case, it would be great if you could share the script, because my delay doesn’t work.

    #48261
    Brendan
    Keymaster

    Hi Jean-Christophe,

    I suspect the error on iOS might be because the field being referenced doesn’t exist perhaps? I’m not sure without having access to your script and form.

    Would you be able to email me a copy of your form template so I can look into it?

    You may also need to check to make sure you have data in the fields before you call the setters too.

    #48260
    Daniel Leu
    Participant

    Yeah, looks like a bug to me.

    I just run a little script and indeed, only ‘four’ appears in the clipboard history (CopyClip):

    function Add_To_Clipboard() {
    	Utils.copyTextToClipboard("one");
    	Utils.copyTextToClipboard("two");
    	Utils.copyTextToClipboard("three");
    	Utils.copyTextToClipboard("four");
    }
    
    Add_To_Clipboard();

    A workaround would be to put all the variables into a JSON formatted string and copy that to the clipboard.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #48256
    Chris Ju
    Participant

    Hi,

    i’m trying to copy some variables to clipboard. However, I would like these to be copied separately to the clipboard. I define the variables (var1, …, var9), but when I use the Utils.copyTextToClipboard(var1) … Utils.copyTextToClipboard(var9) command, only the last variable is copied to the clipboard. I’m using Launchbar-App, with which i could see a history of the clipboard.

    I already used a delay script, between the variables/copy-cammand, but that doesn’t helped.

    Does anyone has an idea?

    Thanks
    Chris

    #48255
    Brendan
    Keymaster

    The script function won’t open a form. Go to the record details screen and tap on the action menu and select Copy Record Link. That’ll give you the URL to view that record.

    #48253
    td4d
    Participant

    I’ve tried to find a way to use the tapformz://script/… function to open a form but with no success. Can you offer an example or suggest what I’m likely missing?

    #48248

    Hello,

    I have two linked forms, like Clients (CDL), one to many with reverse view to Invoices, and a script in Invoices to populate some fields.

    When I create a new record in Invoices, either from Clients or Invoices, the fields are populated well but the app freezes during 30-40 sec on the Mac version and I get an error message on iOS.

    Here’ my screen shots, did the noob miss something ?
    Thanks for help !

    Attachments:
    You must be logged in to view attached files.
    #48247
    td4d
    Participant

    Thanks for the script insight – something for me to look into. The iOS app is aHomeIcon which I believe was free but now sells for $0.99 CAD.

    #48242
    Daniel Leu
    Participant

    What is the freeware utility you are using? Thanks!

    Apart of records, there is a script option as well:

    tapformz://script/[document ID]/[form ID]/[form script name]?key1=value1&key2=value2...
    

    You find this documented in https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api

    • This reply was modified 2 years, 12 months ago by Daniel Leu.
    • This reply was modified 2 years, 12 months ago by Daniel Leu.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #48222
    Gilles Cruypenynck
    Participant

    Hello,

    I’ll try to keep as clear and simple as I can…

    I have 2 forms ‘Factures’ (invoices) and ‘Entreprises’ (clients), classic one Client to many Invoices.
    – ‘Entreprises’ is linked to Factures with a one-to-many relation.
    – Each one of the ‘Entreprises’ has a ‘Code’.
    – In ‘Factures’ I want to concatenate “code_entreprise” with other fields from ‘Factures’.

    I wrote a script which works except for one line where I’m trying to get the ‘Code’ value from ‘Entreprises’ with:
    var code_entreprise = entreprises.getFieldValue(‘fld-e0835c6dcdd9468dbd5b4a65107b20d4’);
    but get a ‘ReferenceError: Can’t find variable: entreprises, line:(null)’

    See line 21 on the screenshot.

    Any clue of what I’m doing wrong?

    Gilles

    Attachments:
    You must be logged in to view attached files.
    Zippidty Doodah
    Participant

    Hey Brandon,

    Just clarification for my brain.

    1. First, disable iCloud sync on ALL devices? (Mac, iPad 1, iPad 2)
    2. Second, click on the Delete from iCloud button on ALL devices? (Mac, iPad 1, iPad 2)
    3. Then switch to Nearby Sync? On ALL devices? (Mac, iPad 1, iPad 2)
    4. Now, add the iPads to the Mac (from the iPad sync setting window)
    5. Conversely, add the Mac to both iPads (via the Mac’s sync settings)

    4 and 5 ensure 2-way sync.

    At that point I should see the changes I mentioned above that are only on iPad 1 sync back to the Mac (?)

    Side note: When looking for an alternative to Bento, I purchased FileMaker Pro. In all it’s glory, FMP was just too much. Finding TapForms saved me many hours of database creation. Because it just works. And as you have refined TapForms, I have been able to refine my databases. I’m still learning that TapForms contains many more refinements than I am currently using (scripts, etc) I so appreciate your continued support of a much needed app for the Mac and the ability to use iPads on location.

    TIA for the additional clarification.

    #48201
    Sam Moffatt
    Participant

    Yah, this isn’t the greatest solution due to the hop over to TF and back but you can basically pull out what ever content you want out of TF and into the Shortcuts ecosystem this way. I’d definitely love a more polished way of executing scripts that takes input and provides output (e.g. scripts support taking a dictionary and provide a dictionary), maybe a feature for a future release. Hopefully this is enough to get you further along with what ever other help you’ve got available to you :)

    #48200
    David Gold
    Participant

    Thank you! The scripting is beyond my pay grade and would still love some kind of Shortcuts support in Tap Forms but what you’ve put together at least shows their is a “hacky” solution at the moment.

Viewing 15 results - 721 through 735 (of 2,951 total)