menu JavaScript Studio

Search JavaScript help

Facebook: https://www.facebook.com/ArrowatLLC Twitter: https://twitter.com/ArrowatLLC Instagram: https://www.instagram.com/ArrowatLLC Youtube: https://www.youtube.com/channel/UCNZV1HjDgVNooR6ePpwTM_Q linkedin: https://www.linkedin.com/showcase/jscriptstudio Arrowat: https://arrowat.com/arrowat

Using files as data information in JavaScript Studio

JavaScript Studio support file creation and file reading using JavaScript, you can fin more reference on File reading using JavaScript explanation.
In this tutorial we will create an app where we add a contact information on a separate JavaScript file and also we will find information on the contact data file from our main app. Using separate files help us to maintain our app more celan and more productive.
Note: File creation and file reading works on JavaScript Studio Pro, You may download JavaScript Studio Pro from our Download Page

Creating Contacts App

  1. Open JavaScript Studio
  2. From menu click on New App

    strmenu

  3. From New App window click Blank App

    newapp

  4. Copy and paste the following code





  5. Save the app as Contacts

    saveapp

    saveappdialog

  6. We are going to create a file that will hold the contacts information and the script code. Click App File from the editor Menu.

    appfiles



  7. From the left bar shown click (+) and click New File

    appfiles

    appfiles

  8. A new empty file window will be shown as following

    createfilewindow
  9. Copy and paste the following code





  10. Save the file as ContactsData Name and select .Txt File extension, this will create a Text file on the app you are developing
    Note we select .Txt file extension becuse it offer better result when reading files that contains JavaScript code from the current app you are developing.


    savefilewindow

    savefilewindow
  11. From the file Menu click Back to code to return to the app code we are developing.

    savefilewindow
  12. Run the app to see the Contacts app working

    savefilewindow



There are some important parts on the app that allows us to read files and show the content in any part of the app.

  1. All file content will be reading at Run-time app.
  2. The <!--<ReadFile><Name>ContactsData </Name></ReadFile>--> allows to read a file, in this app the file is ContactsData and can be added in any part of the HTML code
    Note: This HTML tag reads one file only for each app, and only reads .txt file extension, in this example ContactsData is the file we created and the HTML tag will look for ContactsData.txt, when using this HTML file reading option do not add extension to the file name beacuse it only will read a .txt files. Use it for a large files.
  3. All File content that we are reading will be shown in <ShowFileContentHere/> tag, Since the ContactsData file contains JavaScript Code only and we want to use it as reference from the HTML code when we click the Find Button we have to add the <ShowFileContentHere/> inside of the Script tag, that's why we have the following code in the app

I hope you get the idea how to use JavaScript Studio app and how it can helps you using Files

Posted date: 09/20/2020
Author: Melvin Dev
Twitter: @melvindevdotcom


About the author







Melvin Dev

This documentation has been written by Melvin Dev, Melvin Dev is a founder and developer of Arrowat LLC.


Follow Arrowat: https://arrowat.com/melvindev Facebook: https://www.facebook.com/melvindev Twitter: https://twitter.com/melvindevdotcom Instagram: https://www.instagram.com/melvindevdotcom Youtube: https://www.youtube.com/@melvindev LinkedIn: https://www.linkedin.com/in/melvindevdotcom