Sign in to follow this  
Followers 0
crystalburner

Big Daddy Word.au3

15 posts in this topic

Having trubs with this

_FindReplace($oDoc, "[firstname]", Chr(171) & "Firstname" & chr (187))

Outputting this

"Firstname»

Instead of this

«Firstname»

This doesnt work either

$replacementtext = Chr(0x0000AB) & 'Firstname' & Chr(0x0000BB)

_FindReplace($oDoc, "[firstname]", $replacementtext)

Helppp!

Share this post


Link to post
Share on other sites



If you could post your code here so we can have alittle more idea of what is going on...

Unfortantly, not all or any of us are capable of figuring out rocket science. LOL!!


"...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor"Mess with the best, die like the rest!!" -Hackers"This above all to thine own self be true." -William Shakespeare"Corruption is only as corrupted as the individual makes it out to be." -Mozart_ONLINECheck out this free 1 GB FTP website at DriveHQ.com. You can control the users and even publish a website for free!![s]Your-Start.com - A online website that you can customize to hold all you links, news information, and other website info.[/s]

Share this post


Link to post
Share on other sites

Thats all the code my man

the _findreplace routine in word.au3

Share this post


Link to post
Share on other sites

This seems to be a bug in MS Word. Try doing the find/replace operation manually and you will see that you get the same result.

Share this post


Link to post
Share on other sites

This seems to be a bug in MS Word. Try doing the find/replace operation manually and you will see that you get the same result.

Any idea how i can get about it?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hi,

Maybe do a loop;

Selection.Find.ClearFormatting

With Selection.Find

.Text = "["

.Forward = True

.Wrap = wdFindContinue

End With

Selection.Find.Execute

Selection.Delete Unit:=wdCharacter, Count:=1

Selection.TypeText Text:="«"

Best, Randall

EDIT; works now

Edited by randallc

Share this post


Link to post
Share on other sites

Hi,

Maybe do a loop;

Best, Randall

EDIT; works now

humm

where does that go int he code?

Share this post


Link to post
Share on other sites

humm

where does that go int he code?

RandallC can you write that in autoit?

N

Share this post


Link to post
Share on other sites

heylp!

who can save me?

Share this post


Link to post
Share on other sites

well its been nice talking

its a bug in word,

some nice man called randall has posted some script from mars i have no idea about (VB?) so thats that then!

Share this post


Link to post
Share on other sites

Bah!

Okay I have to lie down now. I have spent hours sweating blood and I feel dizzy

I think this is a good translation of the script from Mars (VB?) but still no joy.

If anyone out there knows something it would help save me committing suicide!

_FindReplaceChar('[', '«')

Func _FindReplaceChar($sCharToReplace, $sChar)

Local $oSelection = ObjCreate("Find.ClearFormatting")

With $oSelection.Find

.Text = $sCharToReplace

.Forward = True

.Wrap = "wdFindContinue"

EndWith

$oSelection.Find.Execute

$oSelection.Delete("wdCharacter", 1)

$oSelection.TypeText($sChar)

EndFunc

Share this post


Link to post
Share on other sites

Bah!

Okay I have to lie down now. I have spent hours sweating blood and I feel dizzy

I think this is a good translation of the script from Mars (VB?) but still no joy.

If anyone out there knows something it would help save me committing suicide!

_FindReplaceChar('[', '«')

Func _FindReplaceChar($sCharToReplace, $sChar)

Local $oSelection = ObjCreate("Find.ClearFormatting")

With $oSelection.Find

.Text = $sCharToReplace

.Forward = True

.Wrap = "wdFindContinue"

EndWith

$oSelection.Find.Execute

$oSelection.Delete("wdCharacter", 1)

$oSelection.TypeText($sChar)

EndFunc

Ooops sorry, really for my mistake, that should have been inside code tags.

_FindReplaceChar('[', '«')

Func _FindReplaceChar($sCharToReplace, $sChar)
Local $oSelection = ObjCreate("Find.ClearFormatting")
With $oSelection.Find
.Text = $sCharToReplace
.Forward = True
.Wrap = "wdFindContinue"
EndWith
$oSelection.Find.Execute
$oSelection.Delete("wdCharacter", 1)
$oSelection.TypeText($sChar)
EndFunc

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Hi,

you will need to use;

Global $wdCharacter = 1, $wdExtend = 1, $wdWord = 2, $wdCell = 12, $wdLine = 5, $wdStory = 6, $wdFindContinue = 1

but the func is not yet in a loop, and will only replace one time at present; I am not sure how to get the return values to know how to stop a loop;

Best, randall [if i had tim e right now.. sorry]

PS - resources;

1. Word forum at Microsoft; near the Excel one;Excel groups

2. try looping using ;

If objSelection.Find.Execute Then

Wscript.Echo "The search text was found."

Else

Wscript.Echo "The search text was not found."

End If

Edited by randallc

Share this post


Link to post
Share on other sites

Hi,

you will need to use;

Global $wdCharacter = 1, $wdExtend = 1, $wdWord = 2, $wdCell = 12, $wdLine = 5, $wdStory = 6, $wdFindContinue = 1

but the func is not yet in a loop, and will only replace one time at present; I am not sure how to get the return values to know how to stop a loop;

Best, randall [if i had tim e right now.. sorry]

PS - resources;

1. Word forum at Microsoft; near the Excel one;Excel groups

2. try looping using ;

I don't know vbscript/windows script any chance you can speak my language!

Share this post


Link to post
Share on other sites

hi,

This works for me; no "save" at present..

;_FindReplaceChar.au3
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp)
Global $wdCharacter = 1, $wdExtend = 1, $wdWord = 2, $wdCell = 12, $wdLine = 5, $wdStory = 6, $wdFindContinue = 1
While _FindReplaceChar($oDoc, '[', '«')
WEnd
;_WordQuit ($oWordApp, 0)
Func _FindReplaceChar($oDoc, $sCharToReplace, $sChar)
    $oSelection = $oDoc.application.selection
    $oSelection.Find.ClearFormatting
    With $oSelection.Find
        .Text = $sCharToReplace
        .Forward = True
        .Wrap = $wdFindContinue
    EndWith
    If $oSelection.Find.Execute Then
        $oSelection.Delete ($wdCharacter, 1)
        $oSelection.TypeText ($sChar)
        ConsoleWrite("return 1"&@LF)
        Return 1
    Else
        ConsoleWrite("return 0"&@LF)
        Return 0
    EndIf
EndFunc   ;==>_FindReplaceChar
Randall

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0