ScriptTap
File

Command video guide

File

File reads, creates, or appends document data. This introduction demonstrates Create + Text: write a new text file in a chosen folder, then show the actual returned name with PromptMe.

Open Scripts from the main overlay menu. In the Script Library, create a new Blank script, rename it, select it and open its editor. Manually drag File from Device into the live script. Open the row and use the header Mode button to select Create. Keep Format: Text.

  • Use In: keep This Script Only for local outputs. Script Thread is available when the values need to be visible to called scripts in the same run.
  • Folder: select only the intended destination in Android's folder picker. If Android asks, allow folder access. The example uses the dedicated ScriptTapTutorials folder.
  • Name Source: Text for a name entered directly, or String Variable for a value prepared by an earlier command. The example requests GuideNote.txt.
  • Content Source: enter Text directly or choose an earlier String variable. The example writes Hello from ScriptTap. Choose the source before entering data: switching away clears that source's outgoing value.
  • If Exists: New Name creates a separate document; Overwrite replaces the existing file and should be used only deliberately. New Name supports Timestamp and Number. The recorded example uses Number, with the original filename already present, to demonstrate automatic collision naming without replacing it.

Optional outputs: enable Save Outputs, then independently select Success Boolean b1, Error String s1, Final Name String s2, and Final URI String s3. Success reports the operation result; a successful operation returns an empty error String. Final Name is the actual collision-resolved filename. Final URI is Android's reference to the created document, not its readable filename.

Save File. Manually drag a supporting PromptMe after it. In Standard mode, use s2 for Header and add a Done button with Boolean b2. The two-command sequence writes the document first, then displays its actual name. Press Done to finish.

Editing does not create the file; the write happens during Play. Use a dedicated tutorial folder and New Name for a non-overwriting demonstration. CSV and JSON are separate formats, while Read brings file data into variables and Append adds data to an existing file.

Intro & Create Text

Step-by-step guide

  1. Step 01

    File lets a script read, create, or append data in files. In this introduction, we'll create a plain-text file and display its actual name with PromptMe. File performs the write; PromptMe only shows the result.

    File step 1: File lets a script read, create, or append data in files. In this introduction, we'll create a plain-text file and display its actual name with PromptMe. File performs the write; PromptMe only shows the result.
  2. Step 02

    From the Script Library, use New Script and choose Blank. The new script is added to the library. Bring its row into view.

    File step 2: From the Script Library, use New Script and choose Blank. The new script is added to the library. Bring its row into view.
  3. Step 03

    Open the menu on the new script's row and choose Rename. Tap the name field, then replace the default name with a clear name for your example. Use OK to confirm it.

    File step 3: Open the menu on the new script's row and choose Rename. Tap the name field, then replace the default name with a clear name for your example. Use OK to confirm it.
  4. Step 04

    Select the new script and open its editor from the main overlay. Existing scripts stay unchanged.

    File step 4: Select the new script and open its editor from the main overlay. Existing scripts stay unchanged.
  5. Step 05

    Expand Device and scroll to File. Drag the command into the live script. The blue insertion line shows where the new command will be placed.

    File step 5: Expand Device and scroll to File. Drag the command into the live script. The blue insertion line shows where the new command will be placed.
  6. Step 06

    Open File. The Mode button cycles through Read, Create, and Append. Choose Create for this example. Set the operation before entering its details.

    File step 6: Open File. The Mode button cycles through Read, Create, and Append. Choose Create for this example. Set the operation before entering its details.
  7. Step 07

    Open Format and keep Text. Text stores ordinary text; CSV stores comma-separated table data, and JSON stores structured data. This example uses a simple text file.

    File step 7: Open Format and keep Text. Text stores ordinary text; CSV stores comma-separated table data, and JSON stores structured data. This example uses a simple text file.
  8. Step 08

    Keep Use In set to This Script Only. This keeps the outputs local. Script Thread is available when the values need to be visible to called scripts in the same run.

    File step 8: Keep Use In set to This Script Only. This keeps the outputs local. Script Thread is available when the values need to be visible to called scripts in the same run.
  9. Step 09

    Use the Folder selector to choose where the file will be created. Select the intended folder in Android's file picker. If Android asks, allow folder access.

    File step 9: Use the Folder selector to choose where the file will be created. Select the intended folder in Android's file picker. If Android asks, allow folder access.
  10. Step 10

    Name Source can use text entered here, or a String variable prepared earlier in the script. Choose the source first: switching away clears that source's value. We'll return to Text.

    File step 10: Name Source can use text entered here, or a String variable prepared earlier in the script. Choose the source first: switching away clears that source's value. We'll return to Text.
  11. Step 11

    Enter a filename, including the text-file extension. We'll use GuideNote dot txt. This is the requested name; the final name can differ if that name already exists.

    File step 11: Enter a filename, including the text-file extension. We'll use GuideNote dot txt. This is the requested name; the final name can differ if that name already exists.
  12. Step 12

    Content Source has the same choice: enter text here, or read an earlier String variable. Switching sources clears the outgoing value. We'll use Text in this example.

    File step 12: Content Source has the same choice: enter text here, or read an earlier String variable. Switching sources clears the outgoing value. We'll use Text in this example.
  13. Step 13

    Enter the text to save. We'll use Hello from ScriptTap. These characters become the file's contents when the command runs.

    File step 13: Enter the text to save. We'll use Hello from ScriptTap. These characters become the file's contents when the command runs.
  14. Step 14

    If Exists controls a name collision. Overwrite replaces the existing file, so use it only deliberately. New Name creates a separate file instead. We'll keep New Name to protect the existing example.

    File step 14: If Exists controls a name collision. Overwrite replaces the existing file, so use it only deliberately. New Name creates a separate file instead. We'll keep New Name to protect the existing example.
  15. Step 15

    New Name can use a timestamp or a number to make a distinct filename. Choose Number here. A file with the original name already exists in the tutorial folder, so this run will demonstrate automatic renaming.

    File step 15: New Name can use a timestamp or a number to make a distinct filename. Choose Number here. A file with the original name already exists in the tutorial folder, so this run will demonstrate automatic renaming.
  16. Step 16

    Turn on Save Outputs to choose optional results. Success, Error, Final Name, and Final URI are independent. Enable only the results that later commands need.

    File step 16: Turn on Save Outputs to choose optional results. Success, Error, Final Name, and Final URI are independent. Enable only the results that later commands need.
  17. Step 17

    Enable Success and use Boolean b1. It reports whether the file operation succeeded.

    File step 17: Enable Success and use Boolean b1. It reports whether the file operation succeeded.
  18. Step 18

    Enable Error and use String s1. This gives later commands error information if the operation fails; a successful operation returns an empty error string.

    File step 18: Enable Error and use String s1. This gives later commands error information if the operation fails; a successful operation returns an empty error string.
  19. Step 19

    Enable Final Name and store it in String s2. This is the actual filename after the collision policy is applied. We'll display this value in the confirmation.

    File step 19: Enable Final Name and store it in String s2. This is the actual filename after the collision policy is applied. We'll display this value in the confirmation.
  20. Step 20

    Enable Final URI and use String s3. A URI is Android's reference to the created document, which can be useful for later processing. It is separate from the readable filename.

    File step 20: Enable Final URI and use String s3. A URI is Android's reference to the created document, which can be useful for later processing. It is separate from the readable filename.
  21. Step 21

    Save the File command. The example now has a complete Create operation with a folder, filename, text, and its chosen outputs.

    File step 21: Save the File command. The example now has a complete Create operation with a folder, filename, text, and its chosen outputs.
  22. Step 22

    Add PromptMe after File by dragging it from the command list. This supporting command makes the returned filename visible while the script waits for us.

    File step 22: Add PromptMe after File by dragging it from the command list. This supporting command makes the returned filename visible while the script waits for us.
  23. Step 23

    Open PromptMe in Standard mode and enter s2 in Header. PromptMe will display the filename stored by File, rather than the literal characters s2.

    File step 23: Open PromptMe in Standard mode and enter s2 in Header. PromptMe will display the filename stored by File, rather than the literal characters s2.
  24. Step 24

    Add one button named Done and give it Boolean b2. The button lets us close the confirmation without reusing File's Success variable.

    File step 24: Add one button named Done and give it Boolean b2. The button lets us close the confirmation without reusing File's Success variable.
  25. Step 25

    Tap OK. File comes first and writes the document; PromptMe follows and reads its returned name. Only these two commands are needed.

    File step 25: Tap OK. File comes first and writes the document; PromptMe follows and reads its returned name. Only these two commands are needed.
  26. Step 26

    Nothing is written just by editing the command. The file is created during Play. This example uses the dedicated tutorial folder and New Name, so it does not replace an existing file.

    File step 26: Nothing is written just by editing the command. The file is created during Play. This example uses the dedicated tutorial folder and New Name, so it does not replace an existing file.
  27. Step 27

    When the script is complete, simply use the Play button in the main overlay.

    File step 27: When the script is complete, simply use the Play button in the main overlay.
  28. Step 28

    The confirmation displays the actual numbered filename. File created a separate document because the original name was already taken. This visible value comes from the Final Name output s2.

    File step 28: The confirmation displays the actual numbered filename. File created a separate document because the original name was already taken. This visible value comes from the Final Name output s2.
  29. Step 29

    Press Done to close the confirmation. The script then finishes automatically.

    File step 29: Press Done to close the confirmation. The script then finishes automatically.
  30. Step 30

    The text file is now saved in the chosen folder. Use File Read to bring its contents into a variable, or Append to add more data. Choose each operation and format for the job your script needs.

    File step 30: The text file is now saved in the chosen folder. Use File Read to bring its contents into a variable, or Append to add more data. Choose each operation and format for the job your script needs.