Yes this is possible. You can use Merge Field or Merge Variable. I would suggest a Merge Variable. From the insert menu select insert Merge Variable.
then after the $$ enter the variable you want such as SortOrder. <<$$SortOrder>> is the way it should look on the layout. Then set variable in your scipt.
Ascending / Descending. Set Variable [$$SortOrder;Value:"Ascending"]
Thanks for the clear instructions how to solve my issue — much appreciated.
Note that if the user sorts the records by any method other than your script (right click, or Ctrl+S) the reminder may not be correct.