# How to write a program as a Julia package?

**URL:** <https://discourse.julialang.org/t/how-to-write-a-program-as-a-julia-package/80574>\
**Category:** General Usage\
**Tags:** code-organization\
**Created:** [May 5, 2022, 9:48pm UTC](https://discourse.julialang.org/t/how-to-write-a-program-as-a-julia-package/80574 "2022-05-05T21:48:04Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)\
**Post date:** [May 8, 2022, 6:45pm UTC](https://discourse.julialang.org/t/how-to-write-a-program-as-a-julia-package/80574/26 "2022-05-08T18:45:37Z")

</div>

### What if your users had to create this type of script file?

**`user_custom_script.jl_script`** :

```julia
#!JLScript -iq --startup-file=no --project=@GlobalScripting_ASME
using ASME_Materials

#raw"": Allows paths with "\" without escaping (ex: "S:\\Material..."):
data_root = raw"S:\Material Properties"

options = (
	input_file = joinpath(data_root, "Section II-D Tables.xlsx"),
	output_dir = joinpath(data_root, raw"Excel Material Data\AIP Q&T Steels"),
)

result = ASME_Materials.RunTheScript(options)
display(result) #Because: Why not?
:DONE

```

…and execute it from with a right-click in Windows Explorer?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/8/a8ba273da46ac397347c5aaa3ca675f4bdc8b4ad.png)

### Example code

→ see: [GitHub - ma-laforge/JuliaScripting.jl](https://github.com/ma-laforge/JuliaScripting.jl)

You could provide (copy) the basic “Scripting interface” from `JuliaScripting.jl`:  
(copying mostly `JuliaScripting/src/install.jl`)

- Creates a sample “shared” Julia environment ( `GlobalScripting_ASME` ).
  - ( `GlobalScripting_ASME` environment is used by sample script [`sample_scripts/sample1.jl_script`](https://github.com/ma-laforge/JuliaScripting.jl/blob/main/sample_scripts/sample1.jl_script).)

- Copies a powershell script ( `launch_julia_script.ps1` ) to the active Julia directory.
  - This might require Windows admin privileges.

- Adds RMB “Execute with Julia” action for `.jl_script` files in Windows Explorer.
  - Also requires Windows admin privileges.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-write-a-program-as-a-julia-package/80574)._
