Topic: Dramatic build time improvement for Portabilitron script (file associations)  (Read 1705 times)

Nobsi

  • Code Baker
  • Jr. Chef
  • **
  • Date Registered: May 2013
  • Posts: 18
Hi all,

I came accross a problem with the otherwise fantastic Portabilitron script when using a lot of file associations foa a applications. The build time was so dramatically slowed down that I initally thought the WinBuilder had crashed.

After doing some research I discovered that the current script does a SOFTWARE hive load/unload cycle for every single file associations within the list for a particular program, which totally slows down the execution. I changed it so that the hive is only loaded/unload once for a program, and build times were back in normal range.

Here is the related change:
Code: [Select]
   If,%CheckB_Asso_%LoopCount%%,Equal,True,If,Not,%TextB_Asso_%LoopCount%%,Equal,,Begin
      StrFormat,SPLIT,%TextB_Asso_%LoopCount%%,#$c,0,%Count%
      //-
      // Only load hive once before looping through all defined associations (greatly reduces required build time)
      RegHiveLoad,Tmp_Software,%RegSoftware%
      Loop,%ScriptFile%,Process_Associate,1,%Count%
      RegHiveUnLoad,Tmp_Software
   End

[Process_Associate]
StrFormat,SPLIT,%TextB_Asso_%LoopCount%%,#$c,#c,%FileAsso%
StrFormat,UCASE,%FileAsso%,%FileAssoU%
If,Not,%FileAsso%,Equal,,Begin
  If,%NoWarnROW%,Equal,True,System,ERROROFF,4
  RegWrite,HKLM,0x1,Tmp_Software\Classes\.%FileAsso%,,%FileAsso%file
  RegWrite,HKLM,0x1,Tmp_Software\Classes\%FileAsso%file,,"%FileAssoU%#$sfile"
  RegWrite,HKLM,0x1,Tmp_Software\Classes\%FileAsso%file\shell,,open
  RegWrite,HKLM,0x2,Tmp_Software\Classes\%FileAsso%file\DefaultIcon,,#$q%PE_Programs%\%TextB_FolderName_%LoopCount%%\%TextB_PgmExe_%LoopCount%%#$q
  RegWrite,HKLM,0x2,Tmp_Software\Classes\%FileAsso%file\shell\open\command,,"#$q%PE_Programs%\%TextB_FolderName_%LoopCount%%\%TextB_PgmExe_%LoopCount%%#$q #$q#$p1#$q"
End

Best regards,
Norbert

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
You are right, it'is better  :thumbsup:,
However Load/Unload hive is quite fast.

:cheers:
« Last Edit: June 13, 2013, 09:43:18 PM by ChrisR »

 

Powered by EzPortal