VBRun>CreateIE
VBRun>Navigate,http://www.pjbc.gob.mx/
VBEval>ExtractTag("BODY",0,0),body
//Here if i set dialog property text on dialog1,msmemo1,text,body
// i can get result
Let>text=%body%
Let>pattern=var1
RegEx>pattern,text,0,matches,num,0,,
// From this point i cant make any modifications to dialog1,msmemo1,text,
// I creaed a subroutine t clear all fields, nothing happens
// even if assign matches_1 as text
Hlp Plz!
Uneditable Msmemo, cat change property text
Moderators: Dorian (MJT support), JRL
Here is the code
Dialog>Dialog1
object Dialog1: TForm
Left = 251
Top = 104
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 216
ClientWidth = 568
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 31
Top = 16
Width = 68
Height = 13
Caption = 'EXPEDIENTE'
end
object expe: TEdit
Left = 117
Top = 8
Width = 121
Height = 21
TabOrder = 0
end
object MemoR: tMSMemo
Left = 9
Top = 44
Width = 488
Height = 89
TabOrder = 1
end
object botonok: tMSButton
Left = 78
Top = 142
Width = 75
Height = 25
Caption = 'OK'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 219
Top = 145
Width = 75
Height = 25
Caption = 'CANCEL'
DoubleBuffered = True
ModalResult = 2
ParentDoubleBuffered = False
TabOrder = 3
DoBrowse = False
BrowseStyle = fbOpen
end
object ProgressBar1: TProgressBar
Left = 36
Top = 181
Width = 469
Height = 17
TabOrder = 4
end
object MSButton1: tMSButton
Left = 334
Top = 143
Width = 75
Height = 25
Caption = 'Clear'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 13
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,botonok,OnClick,ShowResult
AddDialogHandler>Dialog1,MsButton1,OnClick,Clear
Show>Dialog1,r
SRT>ShowResult
Month>m
Day>d
GetDialogProperty>Dialog1,expe,Text,expe
//GoSub>expe
VBRun>CreateIE
VBRun>Navigate,http://www.pjbc.gob.mx/boletinj/2012/my ... %m%%d%.htm
VBEval>ExtractTag("BODY",0,0),BodyText
Let>text=%BodyText%
Let>pattern=%expe%
RegEx>expe,text,0,matches,num,0
MessageModal>matches_1
SetDialogProperty>Dialog1,MemoR,Text,matches_1
END>ShowResult
SRT>Clear
SetDialogProperty>Dialog1,MemoR,Text,
SetDialogProperty>Dialog1,expe,Text,
END>Clear
Problem, After clicking OK, matches_1 should appear in MemoR (msmemo1), but it only appears with messagemodal, why it is not shown?
and why clear buttton does not workafter first ok button.
object Dialog1: TForm
Left = 251
Top = 104
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 216
ClientWidth = 568
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 31
Top = 16
Width = 68
Height = 13
Caption = 'EXPEDIENTE'
end
object expe: TEdit
Left = 117
Top = 8
Width = 121
Height = 21
TabOrder = 0
end
object MemoR: tMSMemo
Left = 9
Top = 44
Width = 488
Height = 89
TabOrder = 1
end
object botonok: tMSButton
Left = 78
Top = 142
Width = 75
Height = 25
Caption = 'OK'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 219
Top = 145
Width = 75
Height = 25
Caption = 'CANCEL'
DoubleBuffered = True
ModalResult = 2
ParentDoubleBuffered = False
TabOrder = 3
DoBrowse = False
BrowseStyle = fbOpen
end
object ProgressBar1: TProgressBar
Left = 36
Top = 181
Width = 469
Height = 17
TabOrder = 4
end
object MSButton1: tMSButton
Left = 334
Top = 143
Width = 75
Height = 25
Caption = 'Clear'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 13
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,botonok,OnClick,ShowResult
AddDialogHandler>Dialog1,MsButton1,OnClick,Clear
Show>Dialog1,r
SRT>ShowResult
Month>m
Day>d
GetDialogProperty>Dialog1,expe,Text,expe
//GoSub>expe
VBRun>CreateIE
VBRun>Navigate,http://www.pjbc.gob.mx/boletinj/2012/my ... %m%%d%.htm
VBEval>ExtractTag("BODY",0,0),BodyText
Let>text=%BodyText%
Let>pattern=%expe%
RegEx>expe,text,0,matches,num,0
MessageModal>matches_1
SetDialogProperty>Dialog1,MemoR,Text,matches_1
END>ShowResult
SRT>Clear
SetDialogProperty>Dialog1,MemoR,Text,
SetDialogProperty>Dialog1,expe,Text,
END>Clear
Problem, After clicking OK, matches_1 should appear in MemoR (msmemo1), but it only appears with messagemodal, why it is not shown?
and why clear buttton does not workafter first ok button.
i just forget the vbscript
VBSTART
Dim IE
'Creates IE instance
Sub CreateIE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible=1
End Sub
'Navigate to an IE instance
Sub Navigate(URL)
IE.Navigate URL
do while IE.Busy
loop
End Sub
'This function extracts text from a specific tag by name and index
'e.g. TABLE,0 (1st Table element) or P,1 (2nd Paragraph element)
'set all to 1 to extract all HTML, 0 for only inside text without HTML
Function ExtractTag(TagName,Num,all)
dim t
set t = IE.document.getElementsbyTagname(Tagname)
if all=1 then
ExtractTag = t.Item(Num).outerHTML
else
ExtractTag = t.Item(Num).innerText
end if
End Function
VBEND
Dim IE
'Creates IE instance
Sub CreateIE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible=1
End Sub
'Navigate to an IE instance
Sub Navigate(URL)
IE.Navigate URL
do while IE.Busy
loop
End Sub
'This function extracts text from a specific tag by name and index
'e.g. TABLE,0 (1st Table element) or P,1 (2nd Paragraph element)
'set all to 1 to extract all HTML, 0 for only inside text without HTML
Function ExtractTag(TagName,Num,all)
dim t
set t = IE.document.getElementsbyTagname(Tagname)
if all=1 then
ExtractTag = t.Item(Num).outerHTML
else
ExtractTag = t.Item(Num).innerText
end if
End Function
VBEND
- Marcus Tettmar
- Site Admin
- Posts: 7393
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You have created a variable caled Text (Let>text=%BodyText%). So this line does nothing:
SetDialogProperty>Dialog1,MemoR,Text,matches_1
Change it to:
SetDialogProperty>Dialog1,MemoR,{"Text"},matches_1
Or use a different variable name.
SetDialogProperty>Dialog1,MemoR,Text,matches_1
Change it to:
SetDialogProperty>Dialog1,MemoR,{"Text"},matches_1
Or use a different variable name.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
:) U just simply get it!
U just know what to do!
By the way, if i assign a variable called ( for example ) Let>ItemIndex=0,
if i try to read a itemindex property from a dialog, Will it be equal to 0?
By the way, if i assign a variable called ( for example ) Let>ItemIndex=0,
if i try to read a itemindex property from a dialog, Will it be equal to 0?
- Marcus Tettmar
- Site Admin
- Posts: 7393
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
No, if you make a variable called ItemIndex and set it to 0 and then try and read the ItemIndex property without passing ItemIndex as a literal then you will be trying to read the value of a property called "0" (ItemIndex=0). And since there is no property called "0" you will get nothing back.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?