8,484
edits
Paradox-01 (talk | contribs) mNo edit summary  | 
				Paradox-01 (talk | contribs)   (read registry with forced 64/32-bit path)  | 
				||
| Line 1: | Line 1: | ||
==General==  | ==General==  | ||
| Line 42: | Line 33: | ||
====Global variables====  | ====Global variables====  | ||
Variables inside a function or sub are local. A local variable can only be used of the sub or function where it was declared.  | |||
Any variable that gets defined outside a function or subroutine is a global variable. Global variables can be used by any sub or function in the file.  | |||
  ' global var 7  | |||
  ' global var  | |||
  MyVar7 = 3 + 0.3  |   MyVar7 = 3 + 0.3  | ||
  sub test  |   sub test  | ||
  	' local var  |   	' local var 8  | ||
  	MyVar8 = 3.3  |   	MyVar8 = 3.3  | ||
  end sub  |   end sub  | ||
  function test2  |   function test2  | ||
  	' local var  |   	' local var 9 and 10  | ||
  	MyVar9  = 3  |   	MyVar9  = 3  | ||
  	MyVar10 = 4 + MyVar7  |   	MyVar10 = 4 + MyVar7  | ||
| Line 182: | Line 170: | ||
==OS   | ==OS bitness==  | ||
  if GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 64 then  |   if GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 64 then  | ||
  	logmessage "64"  |   	logmessage "64"  | ||
| Line 191: | Line 179: | ||
'''faster'''  | '''faster'''  | ||
  Set WshShell = CreateObject("WScript.Shell")  |   Set WshShell = CreateObject("WScript.Shell")  | ||
  if instr(WshShell.RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier"), "  |   if instr(WshShell.RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier"), "64") > 0 then  | ||
 	logmessage "64"  | |||
 else  | |||
  	logmessage "32"  |   	logmessage "32"  | ||
  end if  |   end if  | ||
==XSI/Softimage   | ==XSI/Softimage bitness, version and license==  | ||
There are three possibilities to detect the program's bitness:  | |||
 logmessage Platform  | |||
  logmessage XSIUtils.ResolvePath("$XSI_CPU/")  |   logmessage XSIUtils.ResolvePath("$XSI_CPU/")  | ||
  logmessage XSIUtils.Is64BitOS  | |||
  '   |   ' output for 32-bit installation  | ||
  ' for 64-bit  |  ' INFO : Win32  | ||
  ' INFO : nt-x86\  | |||
 ' INFO : False  | |||
 ' output for 64-bit installation  | |||
 ' INFO : Win64  | |||
  ' INFO : nt-x86-64\  |   ' INFO : nt-x86-64\  | ||
  ' INFO : True  | |||
  '   | |||
  ' INFO :   | |||
For program's version:  | |||
 logmessage version  | |||
 ' examples:  | |||
 ' INFO : 13.0.114.0  | |||
  ' INFO : 7.5.203.0  | |||
For program's license:  | |||
 logmessage license  | |||
 ' examples:  | |||
  ' INFO : Softimage  | |||
 ' INFO : Mod Tool  | |||
DAE files saved with XSI/Softimage contain license information.  | |||
==Read registry==  | ==Read registry==  | ||
This reads the registry with forced 64/32-bit path (RegType). In this example Oni's install location gets revealed.  | |||
  Set WshShell = CreateObject("WScript.Shell")  |   Set WshShell = CreateObject("WScript.Shell")  | ||
  if instr(WshShell.RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier"), "64") > 0 then  | |||
 	OS_bitness = 64  | |||
 else  | |||
 	OS_bitness = 32  | |||
 end if  | |||
 Const HKEY_LOCAL_MACHINE = &H80000002  | |||
 sPath = ReadRegStr (HKEY_LOCAL_MACHINE, _  | |||
 	"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}_is1", _  | |||
 	"InstallLocation", _  | |||
 	OS_bitness)  | |||
 logmessage sPath  | |||
 Function ReadRegStr (RootKey, Key, Value, RegType)  | |||
   Dim oCtx, oLocator, oReg, oInParams, oOutParams  | |||
   Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet")  | |||
   oCtx.Add "__ProviderArchitecture", RegType  | |||
   Set oLocator = CreateObject("Wbemscripting.SWbemLocator")  | |||
   Set oReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv")  | |||
   Set oInParams = oReg.Methods_("GetStringValue").InParameters  | |||
   oInParams.hDefKey = RootKey  | |||
   oInParams.sSubKeyName = Key  | |||
   oInParams.sValueName = Value  | |||
   Set oOutParams = oReg.ExecMethod_("GetStringValue", oInParams, , oCtx)  | |||
   ReadRegStr = oOutParams.sValue  | |||
  End Function  | |||
edits