Your script should go to the layout first and isolate the records that you want in your PDF. Then save the PDF into your temp directory using a variable to create the path. Next go back to the orig layout and send mail with the pdf ( the same variable ) as the referenced attachment.
Are you saying there is a way for the script to do all this you specified? Or are you saying, prior to running the script I should go into the layout, save as pdf...etc. and THEN run the script?
Yes the whole process could be scripted.
Set Variable [ $path; Get ( TemporaryPath ) & pkRecordID & ".pdf" ] // where pkRecordID is the unique record ID, you can replace it with something else you want to name it
Save Records as PDF [ Restore; No Dialogl $path; Records Being Browsed] // enter file:$path under specify output file
Send Mail  // enter file:$path under specify attach file