Action Script with "OR" for Office Architecture Detection

Team,

I’m trying to install an application in a Single Task.
So, What I did was uploaded both Architectures of the application into a single task and then by using conditions I want to chose which one gets deploy.
I was just thinking I can do nested if statements; However, Is there a way of doing OR statements.

I would be using a modified version of this:

(if (exist file "C:\Program Files (x86)\Microsoft Office\Office15\WINWORD.EXE") then ("Microsoft Office 2013 (32-Bit)") else(nothing) ; (if (exist file "C:\Program Files\Microsoft Office\Office15\WINWORD.EXE") then ("Microsoft Office 2013 (64-Bit)") else(nothing)) ; (if (exist file "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE") then ("Microsoft Office 2010 (32-Bit)") else(nothing)) ;(if (exist file "C:\Program Files\Microsoft Office\Office14\WINWORD.EXE") then ("Microsoft Office 2010 (64-Bit)") else(nothing)); (if (exist file "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE") then ("Microsoft Office 2007 (32-Bit)") else(nothing)))

Is there an easier or more practical way to do this? Feedback greatly appreciated.

Not sure if Office if the apps your are dealing with but a detection method we use for getting the version and architecture might help if it is Office.

Q: if (exists regapp "outlook.exe") then ((preceding text of first ";" of following text of first ((preceding text of first "." of (version of regapp "outlook.exe" as string)) & ":") of "8:Office 97;9:Office 2000;10:Office XP;11:Office 2003;12:Office 2007;14:Office 2010;15:Office 2013;16:Office 2016;") & (if (x64 of operating system) then ((if pathname of it as lowercase contains "(x86)" then " 32-bit" else " 64-bit") of regapp "outlook.exe") else (" 32-bit"))) else "NotInstalled"
A: Office 2016 32-bit

Maybe with a slight tweak that could be used to populate an action parameter then do a condition if to jump to the action suitable for the version detected.

parameter "OfficeVersion" = "{if (exists regapp "outlook.exe") then ((preceding text of first ";" of following text of first ((preceding text of first "." of (version of regapp "outlook.exe" as string)) & ":") of "8:97;9:2000;10:XP;11:2003;12:2007;14:2010;15:2013;16:2016;") & (if (x64 of operating system) then ((if pathname of it as lowercase contains "(x86)" then "x86" else "x64") of regapp "outlook.exe") else ("x86"))) else "NotInstalled"}"
If{parameter "OfficeVersion"} = "2007x86"
	// Do Something
elseif{parameter "OfficeVersion"} = "2010x86"
	// Do Something
elseif{parameter "OfficeVersion"} = "2010x64"
	// Do Something
elseif{parameter "OfficeVersion"} = "2013x86"
	// Do Something
endif
1 Like

This is great, I think there is a way that I can use the last words of the parameter, just to pin out the architecture.
something like

elseif {parameter “OfficeVersion”} = “(last 2 of officeversion)”

I will point out that to the BigFix client, that path is the C:\Program Files (x86) path so you might not be getting what you want. It might be better to look at it with the set (native program files folder; program files x32 folder) where the native will give you 64 on a 64 bit and 32 on the 32 bit

@jgstew have you some examples of this somewhere?

not sure why its error in out.

prefetch 31111111111111111111111111 sha1:31111111111111111111111111 size:311 http://BigFixServer.com:52311/Uploads/31111111/MimecastClient.tmp sha256:311111111111
 extract 311111111111111
 parameter "OfficeVersion" = "{if (exists regapp "outlook.exe") then ((preceding text of first ";" of following text of first ((preceding text of first "." of (version of regapp "outlook.exe" as string)) & ":") of "8:97;9:2000;10:XP;11:2003;12:2007;14:2010;15:2013;16:2016;") & (if (x64 of operating system) then ((if pathname of it as lowercase contains "(x86)" then "x86" else "x64") of regapp "outlook.exe") else ("x86"))) else "NotInstalled"}" 
**Failed** If{parameter "OfficeVersion"} = "2007x86" 
 wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\Mimecast for Outlook 7.6.0.26320 (32 bit).msi"}" /qn /norestart 
 elseif{parameter "OfficeVersion"} = "2010x86" 
 wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\Mimecast for Outlook 7.6.0.26320 (32 bit).msi"}" /qn /norestart 
 elseif{parameter "OfficeVersion"} = "2010x64" 
 wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\Mimecast for Outlook 7.6.0.26320 (64 bit).msi"}" /qn /norestart 
 elseif{parameter "OfficeVersion"} = "2013x86" 
 wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\Mimecast for Outlook 7.6.0.26320 (32 bit).msi"}" /qn /norestart 
 elseif{parameter "OfficeVersion"} = "2013x64" 
 wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\Mimecast for Outlook 7.6.0.26320 (64 bit).msi"}" /qn /norestart 
 elseif{parameter "OfficeVersion"} = "2016x86" 
 wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\Mimecast for Outlook 7.6.0.26320 (32 bit).msi"}" /qn /norestart 
 elseif{parameter "OfficeVersion"} = "2016x64" 
 wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\Mimecast for Outlook 7.6.0.26320 (64 bit).msi"}" /qn /norestart 
 endif 

Im trying to see why this is failing now. I really like this idea.

I think I got the syntax slightly wrong

{parameter "OfficeVersion" = "2007x86"}

works (in the Fixlet Debugger)

{parameter "OfficeVersion"} = "2007x86"

doens’t

image

1 Like

Yep that would make it fail for sure. The “if” and “elseif” need to see “True” to take the path.