Code: Select all
For Each aStory In ActiveDocument.StoryRanges
If aStory.StoryType <> wdMainTextStory Then aStory.Font.Reset
Next aStory
Code: Select all
For Each aStory In ActiveDocument.StoryRanges
If aStory.StoryType <> wdMainTextStory Then aStory.Font.Reset
Next aStory
Code: Select all
For Each, aStory In ActiveDocument.StoryRanges
If (aStory.StoryType <> wdMainTextStory)
aStory.Font.Reset
Code: Select all
#InstallKeybdHook
#InstallMouseHook
Loop
{
sleep 100
#SingleInstance Force
}
Numpad6::
Reload
Numpad5::
ExitApp
Numpad1::
Current1()
return
Numpad2::
Current2()
return
Current1()
{
Testing1()
return
}
Current2()
{
Testing2()
return
}
;****TTMsg****
TTMsg(Message, Timer) ;example TTMsg("Testing", 1000)
{
MouseGetPos ttX, ttY
ToolTip, %Message%, ttX + 50, ttY + 50
SetTimer, RemoveToolTip, %Timer%
return
}
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
;----TTMsg----
Testing1()
{
oWord := ComObjActive("Word.Application")
For myStoryRange, In oWord.ActiveDocument.StoryRanges
{
findObject := myStoryRange.Find
findObject.Text := ""
findObject.Font.Color := "255"
findObject.Replacement.Font.Color := "0"
findObject.Replacement.Text := ""
findObject.Forward := 1
findObject.Wrap := 1
findObject.Execute(,,,,,,,,,,2)
While !(myStoryRange.NextStoryRange = "")
{
myStoryRange := myStoryRange.NextStoryRange
findObject := myStoryRange.Find
findObject.Text := ""
findObject.Font.Color := "255"
findObject.Replacement.Font.Color := "0"
findObject.Replacement.Text := ""
findObject.Forward := 1
findObject.Wrap := 1
findObject.Execute(,,,,,,,,,,2)
}
}
return
}
Testing2()
{
oWord := ComObjActive("Word.Application")
For Each, myStoryRange In oWord.ActiveDocument.StoryRanges
{
findObject := myStoryRange.Find
findObject.Text := ""
findObject.Font.Color := "255"
findObject.Replacement.Font.Color := "0"
findObject.Replacement.Text := ""
findObject.Forward := 1
findObject.Wrap := 1
findObject.Execute(,,,,,,,,,,2)
While !(myStoryRange.NextStoryRange = "Nothing")
{
myStoryRange := myStoryRange.NextStoryRange
findObject := myStoryRange.Find
findObject.Text := ""
findObject.Font.Color := "255"
findObject.Replacement.Font.Color := "0"
findObject.Replacement.Text := ""
findObject.Forward := 1
findObject.Wrap := 1
findObject.Execute(,,,,,,,,,,2)
}
}
return
}
Code: Select all
Sub wReColor(wColorFind, wColorReplace)
Dim myStoryRange As Range
For Each myStoryRange In ActiveDocument.StoryRanges
With myStoryRange.Find
.Text = ""
.Font.Color = wColorFind
.Replacement.Text = ""
.Replacement.Font.Color = wColorReplace
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Do While Not (myStoryRange.NextStoryRange Is Nothing)
Set myStoryRange = myStoryRange.NextStoryRange
With myStoryRange.Find
.Text = ""
.Font.Color = wColorFind
.Replacement.Text = ""
.Replacement.Font.Color = wColorReplace
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Loop
Next myStoryRange
End Sub
Code: Select all
ComObjEnum(obj) {
if ComObjType(obj) & 0x2000 ; if *obj* is a SafeArray
return, obj
else if ComObjType(obj) != 9
MsgBox, Object is not a valid Dispatch Object.
else if ComObj_IsMemberOf(obj, "_NewEnum")
return, obj
else if Not ComObj_IsMemberOf(obj, "length")
MsgBox, Object does not have a "Length" property
else,
return, {ComObj:obj, i:0, _NewEnum:Func("ComObj_NewEnum"), Next:Func("ComObj_Next")}
}
ComObj_NewEnum(this) {
return, this
}
ComObj_Next(this, ByRef item) {
if Not this.HasKey("stored")
this.stored := item
if this.i < this.ComObj.length
if ComObj_IsMember(this.ComObj, "item")
return, true, item:=this.ComObj.item(this.i++)
else { ; if there isn't an "item" property/method
retry_enum:
DllCall("SetLastError", "uint", 0) ; Ensure A_LastError is 0
ComError:=ComObjError(), ComObjError(false)
item:=this.ComObj, ComObjError(ComError)
if A_LastError ; if there was a Com Error
if this.i = 1 ; zero-based failed - try one-based
GoTo, retry_enum
else {
MsgBox, Object does not have an "Item" property, and the enumeration attempt failed.
return, false
}
return, true
}
item := this.stored ; Reset the first param in the for-loop
return, false
}
ComObj_IsMemberOf(obj, name) {
return, DllCall(NumGet(NumGet(1*p:=ComObjUnwrap(obj))+A_PtrSize*5), "Ptr",p, "Ptr",VarSetCapacity(iid,16,0)*0+&iid, "Ptr*",&name, "UInt",1, "UInt",1024, "Int*",dispID)=0 && dispID+1, ObjRelease(p)
}
Code: Select all
for key, value in ComObjEnum(yourobject)
Code: Select all
ranges := oWord.ActiveDocument.StoryRanges
Loop % ranges.Count
{
myStoryRange := ranges.Item(A_Index).Text
;...
Code: Select all
For myStoryRange, In oWord.ActiveDocument.StoryRanges
Code: Select all
App := ComObjActive("Word.Application")
Ranges := App.ActiveDocument.StoryRanges
Loop % ranges.Count
{
MsgBox % Ranges.Item[A_Index].Text
}
Users browsing this forum: Anput, Google [Bot], jameswrightesq and 291 guests