Conditional delete
Seems somehow that Sigil (the editor) is not the problem.
For example, I executed your script in Sigil and here is the result: http://share.epiclemon.com/sZdj
I did the same thing in a simple notepad and the same result: http://share.epiclemon.com/sZfw
Here is what I really need: http://share.epiclemon.com/sZZD
I'll keep trying, but if you can help me it would be really awesome. I've sent a small sample text to your support email.
Thank you so much!
For example, I executed your script in Sigil and here is the result: http://share.epiclemon.com/sZdj
I did the same thing in a simple notepad and the same result: http://share.epiclemon.com/sZfw
Here is what I really need: http://share.epiclemon.com/sZZD
I'll keep trying, but if you can help me it would be really awesome. I've sent a small sample text to your support email.
Thank you so much!
Seems I could make some progress Here is what I have now:
StringReplace, Clipboard, Clipboard, `r`n`r`n, %A_Space%, All
This works fine, the only problem is that it takes from the clipboard so I have to modify it to suit my needs. So, I go back to the original code and modify, which is:
But then, it does the same. I am wondering if the clipboard="`r`n`r`n" is correct way of checking agains this special characters. If I do clipboard=`r`n`r`n (without quotes) it does not seem to work fine. Any ideas around this? Thanks so much!
StringReplace, Clipboard, Clipboard, `r`n`r`n, %A_Space%, All
This works fine, the only problem is that it takes from the clipboard so I have to modify it to suit my needs. So, I go back to the original code and modify, which is:
Code: Select all
send {End}{Space}
send +{Right} ;select character on the right
send ^c ;copy it to clipboard
if (clipboard=" " or clipboard="`r`n`r`n")
send {Del}
sleep 150
Only small change is required if you want to remove new lines:
You can also change the file. This assumes the sampletext.txt file is in the script's folder:
Code: Select all
send ^c
sleep 100
text:=Clipboard
newtext:=""
Loop, parse, text, `n,`r
{
line:=A_LoopField
line=%line%
If (line<>"")
newText.=line " " ;added space instead of a new line
}
clipboard:=newtext
sleep 100
send ^v
Code: Select all
FileRead, text, sampletext.txt
newtext:=""
Loop, parse, text, `n,`r
{
line:=A_LoopField
line=%line%
If (line<>"")
newText.=line " "
}
FileDelete, sampletext_mod.txt
FileAppend, %newtext%, sampletext_mod.txt
wow, you are the man Marko! Thanks so much for your help!
Sorry to ask for another thing. I found out that using this takes out italics, underline, etc that I have previously on the text that is being manipulated.
So, back to square one. The script you created is awesome and works great, but unfortunately I need a more manual solution, which is for now, to delete the newline only if the next character is actually a newline and not a regular character. Is there a way to do it in this script you shared before?
So, back to square one. The script you created is awesome and works great, but unfortunately I need a more manual solution, which is for now, to delete the newline only if the next character is actually a newline and not a regular character. Is there a way to do it in this script you shared before?
Code: Select all
send {End}{Space}
send +{Right} ;select character on the right
send ^c ;copy it to clipboard
MsgBox % InStr("clipboard","`r`n`r`n")
if (clipboard=" " or clipboard="`r`n`r`n")
send {Del}
sleep 150
Not sure, how about this?
Instead of end of the line {End} you could go to the end of paragraph: +^{Down}{Right}{Left}
Code: Select all
send {End}{Space}
send +{Right}+{Right} ;select two
send ^c
if (clipboard="`r`n`r`n")
send {Del}{Del}
Thanks for the help!
In here, more than selecting two characters or anything like that, seems that the check condition if the copied character is a new line is not being triggered correctly
In here, more than selecting two characters or anything like that, seems that the check condition if the copied character is a new line is not being triggered correctly
Each editor is different. I tried in Sigil and this appears to work for me:
Even better, why don't you edit the html format? Click on <> icon and then use Find/Replace - copy unwanted tags from the text to Find field and replace all with a space.
Code: Select all
send {End}{Space}
send +{Right}+{Right}
send ^c
if (clipboard="`r`n`r`n`r`n")
send {Del}
I saw that Sigil has some bugs. I have seen that whenever I delete a non-newline character, whenever I paste it to notepad, it is pasted without any newline character at all. So, maybe this is why it is not working fine. Anyways, unfortunately I am stuck with this editor.
Also, I tried what you suggested about editing the HTML, and whenever I do that it kind of breaks the formatting of the justification. It is weird, but anyways.
Marko, thanks a lot for all your help. I've taken already too much of your time. Thanks sooo much for your help and for building such a wonderful software
Also, I tried what you suggested about editing the HTML, and whenever I do that it kind of breaks the formatting of the justification. It is weird, but anyways.
Marko, thanks a lot for all your help. I've taken already too much of your time. Thanks sooo much for your help and for building such a wonderful software