Back

Script examples


Open Notepad with the choose file dialog selected..

[[Script]]
Open "%windir%\system32\notepad.exe"          'This starts Notepad
Wait 1                                'This allows time for Notepad to load
Mouse 21 , 37w
Click                                  ' Clicks Notepad's File menu
Mouse 81 , 83w
Click                                   ' Clicks the Open item on Notepad's file menu


Paste the first six clips from the yellow section, inserting "Clip No (n)" between each..

[[Script]]
Counter1 = 0
Paste "Clip No 1"
Type Enter * 2
Loop CountOfClips
   Counter1 = Counter1 + 1
   If Counter1 > 6
      ExitScript
   EndIf
   PasteClip "Z" + Counter1
   Type Enter * 2
   If Counter1 < 6 then
       Paste "Clip No " + (Counter1 + 1)
   EndIf
   Type Enter * 2
EndLoop


Make any window float on top of other windows..

[[Script]]
Message1 "Activate the Window to float and click continue"
NameWindow "X"
PutOnTop "X"


Split the last copied multi line clip into separate clips, one per line..

[[Script]]
SoundOff
ClearClips
LatestLast
Text1 = LastCopy
'-----------Remove trailing blank lines
Loop
   If Right$(Text1 , 2) = LineBreak
      Text1 = Left$(Text1 , Len$(Text1) - 2)
   Else
      ExitLoop
   EndIf
EndLoop
'---------------------------
Loop
   '-----remove leading blank lines
   Loop
      If Left$(Text1 , 2) = LineBreak
         Text1 = Right$(Text1 , Len$(Text1) - 2)
      Else
         ExitLoop
      EndIf
   EndLoop
   '--------------------
   Counter1 = In$(Text1 , LineBreak , 1)
   If Counter1 = 0
      ExitLoop
   EndIf
   Text2 = Left$(Text1 , Counter1 - 1)
   Text1 = Right$(Text1 , Len$(Text1) - Counter1 + 1)
   MakeClip Text2
EndLoop
MakeClip Text1 'Last line


One of the features of Spartan is the ability to create a clip which contains the date and time. Unfortunately, such clips are in plain text only. If you would like to create form letters or a signature block which has this feature and also text formatting, create the formatted part in your word processor and save it in Spartan, create the part with the date and time and save that in Spartan. Paste them both by creating a script that pastes them one after the other...

[[Script]]
PasteClip H100
PasteClip H101

You can even add the script to your Hot Key or Macro Clips view and run it without having to display Spartan.

 

Back