Archive: Simple String Problem


Simple String Problem
Could someone tell me how to get 1) from 2)

1) "C:\Program Files\cView\cView.exe"

2) "C:\Program Files\cView\cView.exe" "%1"

Your help is greatly appreciated!!


I am all good now I used a code fragment posted by someone before
Here it is for anyone reference:

....
ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""
StrCpy $9 " $\"%1$\""
StrCpy $1 $0
Call removeFromString

....
Function removeFromString
Push $2
Push $3
Push $4
StrCpy $2 0 ; search start
StrLen $3 $9 ; get length of string to remove
loop:
StrCpy $4 $1 $3 $2 ; copy substring of string starting at $2
StrCmp $4 "" done
StrCmp $4 $9 found
IntOp $2 $2 + 1
Goto loop
found:
StrCpy $4 $1 $2 ; $4 is start of string
IntOp $2 $2 + $3
StrCpy $3 $1 "" $2 ; $3 is end of string
StrCpy $1 $4$3 ; $1 is new string
done:
Pop $4
Pop $3
Pop $2
FunctionEnd


This will do the same job in 4 steps:

StrCpy $0 $0 -6 ;remove " "%1" from end
StrLen $1 $0
IntOp $1 $1 - 1
StrCpy $0 $0 "" -$1 ;remove " from start


-Stu