Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add the with keyword
#1
I hope that QM in the future version, can be better compatible with VBA syntax, such as add with keywords

E.g;

VBA:(Find replacement of define content)

With Selection.Find
.ClearFormatting
.Text = "hi"
.Replacement.ClearFormatting
.Replacement.Text = "hello"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With

QM:

Macro Macro4
Code:
Copy      Help
;/exe 1

typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._getactive
app.Selection.Find.ClearFormatting()
app.Selection.Find.Text = "hi"
app.Selection.Find.Replacement.ClearFormatting()
app.Selection.Find.Replacement.Text = "hello"
VARIANT vForward=1
VARIANT vWrap=Word.wdFindContinue
VARIANT vReplaceAll=Word.wdReplaceAll
app.Selection.Find.Execute(@ @ @ @ @ @ vForward vWrap @ @ vReplaceAll)
app.ActiveDocument.Save

change to: Idea

Macro Macro4
Code:
Copy      Help
;/exe 1

typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._getactive
With app.Selection.Find
,ClearFormatting()
,Text = "hi"
,With Replacement
,,ClearFormatting()
,,Text = "hello"
VARIANT vForward=1
VARIANT vWrap=Word.wdFindContinue
VARIANT vReplaceAll=Word.wdReplaceAll
app.Selection.Find.Execute(@ @ @ @ @ @ vForward vWrap @ @ vReplaceAll)
app.ActiveDocument.Save
#2
Nothing new will be added to the QM2 language. QM3 will use C# instead. C# does not support 'with', except when creating new object with 'new'.
#3
I hope that the future version of QM3, VBA support, more easy to understand Big Grin
#4
like this? Tongue

Code:
Copy      Help
User u = new User()
{
   ID = 123456,
   Name = "test",
   Password = "test"
};


or:
Code:
Copy      Help
using abc = a.b.c.d;
abc.xxx = "xxx";
abc.yyy();
#5
yes
#6
I google search for the code, in fact, I do not understand C #, only understand point VBA Big Grin
#7
Just found the AHK code, I hope QM developers also learn from the AHK syntax advantage, in the future version to improve the QM Idea

Four lines of code, control word, the syntax is very simple

AHK Code:

Word := ComObjCreate("Word.Application")
Doc := Word.Documents.Add
Doc.SaveAs("C:\test.doc")
Word.Quit
#8
QM Code :
Use the following code to run unsuccessfully Confusedhock:

Macro Run Word, open file
Code:
Copy      Help
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._create
Word.Documents doc=app.Documents.Add
doc.SaveAs("C:\test.doc")
app.Quit


Forum Jump:


Users browsing this thread: 1 Guest(s)