Add the with keyword

What new features you would like to see in next QM version?

Add the with keyword

Postby kyjdp on Sat Mar 18, 2017 7:56 am

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     ?
;/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     ?
;/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
kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am

Re: Add the with keyword

Postby Gintaras on Sat Mar 18, 2017 8:06 am

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'.
Gintaras
Site Admin
 
Posts: 10298
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Add the with keyword

Postby kyjdp on Sat Mar 18, 2017 8:10 am

I hope that the future version of QM3, VBA support, more easy to understand :D
kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am

Re: Add the with keyword

Postby kyjdp on Sat Mar 18, 2017 8:20 am

like this? :P

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

Warning: The code possibly is invalid because some important characters (tabs, spaces) disappeared. Read more.


or:
using abc = a.b.c.d;
abc.xxx = "xxx";
abc.yyy();
Last edited by kyjdp on Sat Mar 18, 2017 8:23 am, edited 1 time in total.
kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am

Re: Add the with keyword

Postby Gintaras on Sat Mar 18, 2017 8:23 am

yes
Gintaras
Site Admin
 
Posts: 10298
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Add the with keyword

Postby kyjdp on Sat Mar 18, 2017 8:24 am

I google search for the code, in fact, I do not understand C #, only understand point VBA :D
kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am

Re: Add the with keyword

Postby kyjdp on Sat Mar 18, 2017 10:18 am

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
kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am

Re: Add the with keyword

Postby kyjdp on Sat Mar 18, 2017 10:29 am

QM Code :
Use the following code to run unsuccessfully :shock:

Macro Run Word, open file     ?
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

kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am


Return to Wish List

Who is online

Users browsing this forum: No registered users and 1 guest