Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; 2010 Mark Sikkema aka Gringoloco
- ;_____________________________________________________________________________
- ;=== adjustable settings
- !define COUNTER 3000 ;20 ; amount of loops to be made
- ; !define ShowDetails ; only show detail to debug cause it really slows things down
- !define LauncherFile "$EXEDIR\PortableApps.comLauncher.ini"
- !define Section "Environment" ;FilesMove" ; section to scan
- ; !include ForEachINIPair1.nsh ; choose which script to time !
- !include ForEachINIPair2.nsh
- ;_____________________________________________________________________________
- !macro Loop
- !ifdef \0 ; NullByte.nsh is included so this is ForEachINIPair2.nsh(exclude ${CreateHandle}&${FreeHandle} to speed things up)
- !undef CreateHandle ; insert empty macro to replace ${CreateHandle}
- !define CreateHandle '!insertmacro EmptyMacro'
- !undef FreeHandle ; insert empty macro to replace ${FreeHandle}
- !define FreeHandle '!insertmacro EmptyMacro'
- !insertmacro CreateHandle $_FEIP_Buffer
- !endif
- ${Do}
- ;_____________________________________________________________________________
- ;=== actual scrip to time
- ${ForEachINIPair} "${Section}" $VAR1 $VAR2
- DetailPrint "$VAR1 = $VAR2"
- ${NextINIPair}
- ;_____________________________________________________________________________
- IntOp $COUNTER $COUNTER + 1
- ${LoopUntil} $COUNTER = ${COUNTER}
- !ifdef \0 ; NullByte.nsh is included so this is ForEachINIPair2.nsh
- !insertmacro FreeHandle $_FEIP_Buffer
- !else
- FileClose $_FEIP_FileHandle
- !endif
- !macroend
- ;_____________________________________________________________________________
- ;_____________________________________________________________________________
- OutFile "TIMENSISFunctions.exe"
- !ifndef ShowDetails
- SilentInstall silent ; if set to normal or commented out, make sure to lower counter by a min. decimal
- AutoCloseWindow True
- !endif
- !include LogicLib.nsh
- !include TIME.nsh
- !define TrimNewLines '!insertmacro TrimNewLines'
- !macro EmptyMacro VAR ; empty macro to replace ${CreateHandle} & ${FreeHandle}
- Nop
- !macroend
- !macro TrimNewLines VAR1 VAR2
- Push ${VAR1}
- call TrimNewlines
- Pop ${VAR2}
- !macroend
- Var LauncherFile
- Var VAR1
- Var VAR2
- Var COUNTER
- Var TIME
- Var TIME1
- Var TIME2
- Section "Main"
- SetDetailsView show
- StrCpy $LauncherFile ${LauncherFile}
- ${TIME::GetLocalTIME} $TIME1
- !insertmacro Loop
- ${TIME::GetLocalTIME} $TIME2
- ${TIME::MathTIME} "second($TIME2) - second($TIME1) = second" $TIME
- Messagebox MB_OK "Done! $\nSeconds for operation=$TIME"
- ${TIME::Unload}
- SectionEnd
- !ifndef \0 ; NullByte.nsh is not included so this is ForEachINIPair1.nsh
- Function TrimNewlines ; TrimNewLines is needed for ForEachINIPair1.nsh
- Exch $R0
- Push $R1
- Push $R2
- StrCpy $R1 0
- loop:
- IntOp $R1 $R1 - 1
- StrCpy $R2 $R0 1 $R1
- StrCmp $R2 "$\r" loop
- StrCmp $R2 "$\n" loop
- IntOp $R1 $R1 + 1
- IntCmp $R1 0 no_trim_needed
- StrCpy $R0 $R0 $R1
- no_trim_needed:
- Pop $R2
- Pop $R1
- Exch $R0
- FunctionEnd
- !endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement