Advertisement
Guest User

Untitled

a guest
Mar 31st, 2010
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; 2010 Mark Sikkema aka Gringoloco
  2. ;_____________________________________________________________________________
  3. ;=== adjustable settings
  4.     !define COUNTER 3000 ;20 ; amount of loops to be made
  5. ;   !define ShowDetails ; only show detail to debug cause it really slows things down
  6.     !define LauncherFile "$EXEDIR\PortableApps.comLauncher.ini"
  7.     !define Section "Environment" ;FilesMove" ; section to scan
  8. ;   !include ForEachINIPair1.nsh ; choose which script to time !
  9.     !include ForEachINIPair2.nsh
  10. ;_____________________________________________________________________________
  11. !macro Loop
  12. !ifdef \0 ; NullByte.nsh is included so this is ForEachINIPair2.nsh(exclude ${CreateHandle}&${FreeHandle} to speed things up)
  13.     !undef CreateHandle ; insert empty macro to replace ${CreateHandle}
  14.     !define CreateHandle  '!insertmacro EmptyMacro'
  15.     !undef FreeHandle ; insert empty macro to replace ${FreeHandle}
  16.     !define FreeHandle  '!insertmacro EmptyMacro'
  17.     !insertmacro CreateHandle $_FEIP_Buffer
  18. !endif
  19.     ${Do}
  20. ;_____________________________________________________________________________
  21. ;=== actual scrip to time
  22.         ${ForEachINIPair} "${Section}" $VAR1 $VAR2
  23.             DetailPrint "$VAR1 = $VAR2"
  24.         ${NextINIPair}
  25. ;_____________________________________________________________________________
  26.         IntOp $COUNTER $COUNTER + 1
  27.     ${LoopUntil} $COUNTER = ${COUNTER}
  28. !ifdef  \0 ; NullByte.nsh is included so this is ForEachINIPair2.nsh
  29.     !insertmacro FreeHandle $_FEIP_Buffer
  30. !else
  31.     FileClose $_FEIP_FileHandle
  32. !endif
  33. !macroend
  34. ;_____________________________________________________________________________
  35. ;_____________________________________________________________________________
  36. OutFile "TIMENSISFunctions.exe"
  37. !ifndef ShowDetails
  38.     SilentInstall silent ; if set to normal or commented out, make sure to lower counter by a min. decimal
  39.     AutoCloseWindow True
  40. !endif
  41. !include LogicLib.nsh
  42. !include TIME.nsh
  43. !define TrimNewLines '!insertmacro TrimNewLines'
  44. !macro EmptyMacro VAR ; empty macro to replace ${CreateHandle} & ${FreeHandle}
  45.     Nop
  46. !macroend
  47. !macro TrimNewLines VAR1 VAR2
  48.     Push ${VAR1}
  49.     call TrimNewlines
  50.     Pop ${VAR2}
  51. !macroend
  52. Var LauncherFile
  53. Var VAR1
  54. Var VAR2
  55. Var COUNTER
  56. Var TIME
  57. Var TIME1
  58. Var TIME2
  59.  
  60. Section "Main"
  61. SetDetailsView show
  62. StrCpy $LauncherFile ${LauncherFile}
  63. ${TIME::GetLocalTIME} $TIME1
  64.     !insertmacro Loop
  65. ${TIME::GetLocalTIME} $TIME2
  66. ${TIME::MathTIME} "second($TIME2) - second($TIME1) = second" $TIME
  67. Messagebox MB_OK "Done! $\nSeconds for operation=$TIME"
  68. ${TIME::Unload}
  69. SectionEnd
  70.  
  71. !ifndef \0 ; NullByte.nsh is not included so this is ForEachINIPair1.nsh
  72.  Function TrimNewlines ; TrimNewLines is needed for ForEachINIPair1.nsh
  73.    Exch $R0
  74.    Push $R1
  75.    Push $R2
  76.    StrCpy $R1 0
  77.  
  78.  loop:
  79.    IntOp $R1 $R1 - 1
  80.    StrCpy $R2 $R0 1 $R1
  81.    StrCmp $R2 "$\r" loop
  82.    StrCmp $R2 "$\n" loop
  83.    IntOp $R1 $R1 + 1
  84.    IntCmp $R1 0 no_trim_needed
  85.    StrCpy $R0 $R0 $R1
  86.  
  87.  no_trim_needed:
  88.    Pop $R2
  89.    Pop $R1
  90.    Exch $R0
  91.  FunctionEnd
  92. !endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement