# Space Automation Pro for Space Planning - VB - Visual Studio Syntax Questions



## parkerbelt (Jun 6, 2017)

I've recently acquired Space Automation Pro and I'm attempting to write some VB scripts in Visual Studio - to automate the manipulation of Space Planning modulars, but I'm having a hard time getting the correct syntax to do what I would like to do. 

Does anyone know where I could learn the syntax for this?

Here is a sample of the type of code that is used and what I'm trying to do, but the syntax isn't correct.


```
Option Strict On
#Region "Imports"


Imports System.Collections.Generic
Imports System.Text
Imports JDA.Intactix.Automation


#End Region


Public Class SpaceMenuClass
    Inherits Script


    Public Sub New()
        MyBase.New()
    End Sub


    Public Sub New(ByVal nSpaceOrFloor As Integer)
        MyBase.New(nSpaceOrFloor)
    End Sub


    Public Overrides Sub Run(Optional isSilentMode As Boolean = False)
        'Script Lines go here



Dim CurrentPlanogram As Integer

CurrentPlanogram = 0
SpacePlanning.SetActivePlanogram(CurrentPlanogram)
SpacePlanning.SelectAllDrawings()
SpacePlanning.CopyToClipboard()
CurrentPlanogram = CurrentPlanogram + 1
SpacePlanning.SetActivePlanogram(CurrentPlanogram)
SpacePlanning.PasteFromClipboard()
SpacePlanning.SelectFixture("TP INFANT PLATFORM SHELF 3X93X50", False)
' Figure out what to put between the brackets to delete all positions on the planogram
SpacePlanning.DeletePositionsWithCondition("*")




    End Sub
End Class
```


I've been studying the Space Automation Commands in the Space Automation, Help section of Visual Studio, but, unless I'm doing exactly what the example shows, I don't know the syntax to use to do what I would like to do. What is the best way for me to learn the syntax - Are there other resources available? 


Any suggestions?
Thanks in advance!!


----------



## tleisusmc (Oct 24, 2019)

Good morning ! Did you ever find an answer for this? I am doing the same and struggling!


----------



## parkerbelt (Oct 24, 2019)

tleisusmc said:


> Good morning ! Did you ever find an answer for this? I am doing the same and struggling!



I ended up joining the SIG, which is a Space Automation Information Group that JDA puts out. You can ask questions on their and some people respond to questions that you ask. I also reached out to JDA's help desk with questions and issues and networked with other users in my local community. I hope that helps you - good luck!


----------



## tleisusmc (Nov 6, 2019)

Hello again! I am a distributor and am having the hardest time with writing these scripts. I do not have access to the JDA community page I guess being I am a distributor and my licenses were provided by AB so technically not a customer of JDA even though I use it every day. Anyways, I thought it would be a good idea to use the script recording macro to help write a custom scripts. I was able to rename a fixture but my goal is to select all fixtures as is shown...but change the name to all of them at once. Not just one selected fixture. here is what i have so far.


Option Strict Off

Imports JDA.Intactix.Automation
Imports System.IO
ImportsJDA.Intactix.Automation.SpacePlanning
ImportsJDA.Intactix.Automation.Space.Planogram


Namespace SpaceMenuAssembly
    Public ClassSpaceMenuClass
        InheritsScript

        PublicSub New()
           MyBase.New()
        End Sub

        PublicSub New(ByVal nSpaceOrFloor As Integer)
           MyBase.New(nSpaceOrFloor)
        End Sub

        PublicOverrides Sub Run(Optional isSilentMode As Boolean = False)
           SpacePlanning.DeselectAllObjects()
           SpacePlanning.SelectAllFixtures()
           SpacePlanning.SetSelectedFixtureAttributes(SpaceFixtureFields.Name,"")


        End Sub
    End Class
End Namespace

I would like to set all fixture names to the segment number and fixture location ID but only see how to change for one. Do you have any idea of what I can add? I haven't had the new Space Planning long and am used to the old Space Auto Classic. Any help is appreciated as my access to JDA forums and such is limited


----------



## tleisusmc (Nov 6, 2019)

Oh, one more thing, How do I add get that script to run from the ribbon with the others as a executable?


----------



## tleisusmc (Nov 6, 2019)

parkerbelt said:


> I ended up joining the SIG, which is a Space Automation Information Group that JDA puts out. You can ask questions on their and some people respond to questions that you ask. I also reached out to JDA's help desk with questions and issues and networked with other users in my local community. I hope that helps you - good luck!



Well, I cannot delete my previous comment from today but i did Record a Script and aquire the VBScriptfile and seen that in order to have it run in SPP I need to open it in SAPRO to compile...I do not have SAPRO since the software supplier only has one SAPRO license.  Is there an easier way to aquire the Space Planning SAPRO template and I can rewrite them myself in VS15 or another way to convert these recorded scripts I made to run in spp without SAPRO? Im drowning haha! My job is so much simpler and accurate with the simplicity of scripts.


----------

