Hi,
I want to call a powershell script from another powershell script.
Add To Shop
$shop_var = get-osa -name "Shopping List"
$shopValue = $shop_var.properties["Value"].value
set-osa -name "Shopping List" -property "Value" -value "$shopValue PARAMETERINPUT"
Add Bread
invoke-osascript -name "Add To Shop" -parameter2 "Bread"
But how do i get the parameter inside Add to Shop script?
Cheers
Powershell script inside powershell script
-
- Posts: 86
- Joined: Wed Feb 06, 2013 12:12 pm
Re: Powershell script inside powershell script
there is a -nested parameter when calling another powershell script which will run the second script in the same process so it will have access to any variable created in the first script
$item = "Bread"
invoke-osascript -name "Add To Shop" -nested "TRUE"
then inside your add to shop script you will be able to access the $item variable
$item = "Bread"
invoke-osascript -name "Add To Shop" -nested "TRUE"
then inside your add to shop script you will be able to access the $item variable
Re: Powershell script inside powershell script
Going from memory I think what he is looking for is $Parameter2 or $Parameter2.value