Thanks for replying.
How would I best do that? To do a find for the primary key of the current record I'm viewing...
A 'Find' script that searches for that record's UID will work. Another simple way, if you want to isolate the current record easily, is to 'Show All', then 'Omit Record', then 'Show omitted'.
How about print "current record" print option?
Look in your help for this:
Inserting merge variables onto a layout
You can create a merge variable that displays a value from a variable. You can use merge variables for some tasks in place of global fields or unstored calculation fields. For example, a merge variable could display the total cost at the bottom of an invoice, or display the name of the account used to print a report.
You see the merge variable value in Browse, Find, and Preview modes, and when you print records.
1 of 1 people found this helpful
Here's what I would do, particularly if I was exposing the user to the Print dialog:
Before printing, I perform these steps in sequence.
Show All Records
Show Omitted Only
If I wanted someone else to do the printing and the above is an ad-hoc, not a scripted action, I would substitute Save as Snapshot Link instead of Print and send it to them.
FWIW, DBurnham beat me to what I was going to recommend.
I had worked around this by setting the Print Setup dialog box to show (so they can change destination printer) and the Print dialog box not show up, having set it to just print current record.
HOWEVER something else is occurring that I've just noticed and that I cannot seem to work out a fix for.
When the script runs, on clicking a button, the layout changes to show the letter with merge fields inserted, and a custom dialog box come up to inform the user to insert a letterhead into the printer and to press "Print" to continue. (I had to do this as some forms require more or less pre-printed letterheads to be inserted in a shared printer).
If they cancel, they return to the last page they came from, but if they hit print then the script continues to Print Setup (where they can change the destination printer should that be required) and when they hit "OK" the page(s) all comes out fine.
BUT I've just noticed that if they hit "Cancel" at this stage, the script continues and the page still prints.
How can I stop this happening???
The script for this 'letter 2' is as follows:
Enter Browse Mode 
Go to Layout [ “Letter 2” (CLIENTS) ]
Sort Records [ Restore; No dialog ]
View As [ View as Form ]
Show Custom Dialog [ Title: "Print Letter 2"; Message: "Please insert one letterhead into the printer, then press \"Print\" to continue."; Default Button: “Print”, Commit: “Yes” ; Button 2: “Cancel” , Commit: “Yes” ]
If [ Get(LastMessageChoice)=1 ]
Print Setup [ Restore ]
Print [ Restore: 01 HP LaserJet Pro P1102w; No dialog ]
Go to Layout [ “CLIENTS” (CLIENTS) ]
Go to Layout [ “CLIENTS” (CLIENTS) ]
Many thanks in advance
Include a step 'Allow user abort' and set to 'no', then handle what you want to happen inside the script. Presumably take them to an original layout and halt, or something else tidy.
And where would that be best placed in the script above? Before the "If [Get(LastMessageChoice..." line?
I'd want to go to the "CLIENTS" layout already mentioned in the script (and where the script, so far, correctly goes to if the initial custom dialog box "Cancel" is clicked, or if the printing has been concluded normally).
I typically use the get (lastError) function call to detect if the user has clicked Cancel in a system dialog.
And how would I best use that in my script above to get around the issue I have?
set error capture [on]
Step that opens system dialog here
If [Get (LastError ) = 1// user cancelled]
Do what should happen if they cancel
Do what should happen if they don't
I use this often with insert file and insert picture. It should also work for print dialogs.
Apologies, it appears that posting code from an iPhone doesn't work very well. I've now edited my previous answer to include text omitted from my iPhone post.