8,452
edits
Paradox-01 (talk | contribs) mNo edit summary |
Paradox-01 (talk | contribs) mNo edit summary |
||
Line 590: | Line 590: | ||
' additional quote signs tells the program where the | ' additional quote signs tells the program where the | ||
' paths strings start and end in case the path contains spaces | ' paths strings start and end in case the path contains spaces | ||
' if you are going to use the xml file right after its extraction (which is likely) | ' if you are going to use the xml file right after its extraction (which is likely) | ||
' then the "/wait" argument inside the onisplit_action string is important | ' then the "/wait" argument inside the onisplit_action string is important | ||
Line 603: | Line 603: | ||
' INFO : relative path: cmd /C start OniSplit.exe -extract:xml "..\GameDataFolder" "..\GameDataFolder\level19_Final\ONLVcompound.oni" | ' INFO : relative path: cmd /C start OniSplit.exe -extract:xml "..\GameDataFolder" "..\GameDataFolder\level19_Final\ONLVcompound.oni" | ||
XSIUtils.LaunchProcess onisplit_action, 1, onisplit_location | XSIUtils.LaunchProcess onisplit_action, 1, onisplit_location | ||
' absolute path | ' absolute path | ||
Line 623: | Line 623: | ||
onilocation = "F:\Program Files (x86)\Oni\Edition" | onilocation = "F:\Program Files (x86)\Oni\Edition" | ||
XSIUtils.LaunchProcess onibat, 0, onilocation | XSIUtils.LaunchProcess onibat, 0, onilocation | ||
' alternative to cmd: call onisplit directly via winmgmts | |||
' slightly modified code from [http://blogs.technet.com/b/heyscriptingguy/archive/2006/12/08/how-can-i-start-a-process-and-then-wait-for-the-process-to-end-before-terminating-the-script.aspx that site] | |||
' ''logmessage "onisplit finished."'' will be executed after the conversion finished, there should be also an delay of 3 seconds to support very slow computers | |||
' if you are going to use this method consider to extent the code to check if input file and output directory exist | |||
osp_loca = "C:\OniAE\Edition\install\OniSplit.exe" | |||
osp_action = "-extract:xml" | |||
osp_output = """C:\OniAE\Edition\GameDataFolder""" | |||
osp_input = """C:\OniAE\Edition\GameDataFolder\level1_Final\AKEVEnvWarehouse.oni""" | |||
osp_total = osp_loca & " " & osp_action & " " & osp_output & " " & osp_input | |||
logmessage osp_total | |||
strComputer = "." | |||
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process") | |||
objWMIService.Create osp_total, null, null, intProcessID | |||
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") | |||
' wait 3 second to find event - should be enough time for single actions on a slow computer | |||
Set colMonitoredProcesses = objWMIService.ExecNotificationQuery _ | |||
("Select * From __InstanceDeletionEvent Within 3 Where TargetInstance ISA 'Win32_Process'") | |||
Do Until i = 1 | |||
Set objLatestProcess = colMonitoredProcesses.NextEvent | |||
If objLatestProcess.TargetInstance.ProcessID = intProcessID Then | |||
i = 1 | |||
End If | |||
Loop | |||
logmessage "onisplit finished." | |||
' now you can work with the extracted xml file | |||
edits