AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COM iWeb Inet explorer window Focus Problem

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
VibrantLife



Joined: 29 Oct 2009
Posts: 47

PostPosted: Tue Nov 24, 2009 8:52 pm    Post subject: COM iWeb Inet explorer window Focus Problem Reply with quote

Sorry for opening a new thread!

I have a 2 display setup, with @ each 1 Internet explorer 7 window with different tabs open.
and i have a Focus problem between them!

When i run the code below: lastname data is copied from left window, and paste at the right textbox of the right window. Thats alright

But at the 2nd action(firstname, copy/paste)
The left screen doesn't focus with: pwb:=iWeb_getwin("Contact: ")
So i tried the green lines(ifWinNotActive).
This works for the Right screen but not for left, because its not complete.

Because the Title text after Contact: is changed with every new Contact.

I tried also the url
Code:
pwb:=iWeb_getwin("http://dummyadress/sfa/conts/edit.aspx?id={9EF12E53-9AAC-DC11-B02A-005056877E90}")


But Bold part is changing also with Contact change
http://dummyadress/sfa/conts/edit.aspx?id={9EF12E53-9AAC-DC11-B02A-005056877E90}

If have some more info:
This is how the Title lookslike:
Contact: Brink, Richard - Windows Internet Explorer
Where contact name (Brink, Richard) is changed at new load.

I lookup with Webrecorder where the page gets the Title:
it is a [innertext]=Contact: Brink
Code:

msgbox % iWeb_getDomObj(pwb,"455")
iWeb_clickDomObj(pwb,"455")
iWeb_setDomObj(pwb,"455", "Contact: Brink")

Read from HTML: <TD class=formTitle noWrap>Contact: Brink</TD>


I use the latest AHK build 1.0.47.00. and updated COM library from 8 oct, and iWeb library from 22 nov.

Is there a way, out there, to get focus between these 2 windows??

Thank you!
Code:
 
#include COM.ahk
#include iWeb.ahk
COM_CoInitialize()

$0::
;WinWait, Contact:  - Windows Internet Explorer,
;IfWinNotActive, Contact:  - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
;WinWaitActive, Contact:  - Windows Internet Explorer,
sleep 50
Clipboard :=
pwb:=iWeb_getwin("Contact: ") ;Window left Display
COM_Invoke(pwb, "document.all.item[lastname].focus"), ; Textbox to capture
sleep 50
Send, {CtrlDown}a{CtrlUp}{CtrlDown}c{CtrlUp}
ClipWait, 0.2  ; wait 0.2 sec for copy operation to happen

if ErrorLevel   ; error is trown when timeout occurs without a clipboard copy operation
{
   
}
else
{
WinWait, Invoeren persoon - Windows Internet Explorer,
IfWinNotActive, Invoeren persoon - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
WinWaitActive, Invoeren persoon - Windows Internet Explorer,
sleep 50
pwb:=iWeb_getwin("Invoeren persoon") ;Window right display
iWeb_setDomObj(pwb,"ctl00xKxHxMAxFAxIAxgeslachtEdit_input", "man")
COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus"), ; Textbox to paste
sleep 100
Send, ^v
}
sleep 100
WinWait, Contact:  - Windows Internet Explorer,
IfWinNotActive, Contact:  - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
WinWaitActive, Contact:  - Windows Internet Explorer,
sleep 50
Clipboard :=
pwb:=iWeb_getwin("Contact: ")
COM_Invoke(pwb, "document.all.item[firstname].focus"),
sleep 50
Send, {CtrlDown}a{CtrlUp}{CtrlDown}c{CtrlUp}
ClipWait, 0.2  ; wait 0.2 sec for copy operation to happen

if ErrorLevel   ; error is trown when timeout occurs without a clipboard copy operation
{
   
}
else
{
WinWait, Invoeren persoon - Windows Internet Explorer,
IfWinNotActive, Invoeren persoon - Windows Internet Explorer, , WinActivate, Invoeren persoon - Windows Internet Explorer,
WinWaitActive, Invoeren persoon - Windows Internet Explorer,
sleep 50
pwb:=iWeb_getwin("Invoeren persoon")
COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_roepNaamEdit].focus"),
sleep 100
Send, ^v
}
sleep 100
COM_Release(objIE)
COM_Term()
return


omg Thisss thread: IE Active Tab!!!! is the answer...:
http://www.autohotkey.com/forum/viewtopic.php?p=231093#231093

But i have no noobie idea to use it with my code Crying or Very sad
Can someone please give me somesort of example am stuck here.
_________________
The signature is away at the moment, please leave a message after the beep...


Last edited by VibrantLife on Tue Nov 24, 2009 11:25 pm; edited 2 times in total
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 2427

PostPosted: Tue Nov 24, 2009 11:23 pm    Post subject: Reply with quote

Apparently the recorder isn't catching the whole window title...maybe this will work?


Code:
#include COM.ahk
#include iWeb.ahk
COM_CoInitialize()

$0::
Clipboard=
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}

tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window left Display
. . .


But why are you sending focus to the field to copy the data? You could use iWeb functions to copy the data straight out of the field:

Code:
lastname:=iWeb_getDomObj(pwb,"lastname")
;COM_Invoke(pwb, "document.all.item[lastname].focus"), ; Textbox to capture
;sleep 50
;Send, {CtrlDown}a{CtrlUp}{CtrlDown}c{CtrlUp}
;ClipWait, 0.2  ; wait 0.2 sec for copy operation to happen
. . .
iWeb_setDomObj(pwb,"ctl00xKxHxMAxFAxIAxgeslachtEdit_input", "man")
;COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus"), ; Textbox to paste

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
VibrantLife



Joined: 29 Oct 2009
Posts: 47

PostPosted: Tue Nov 24, 2009 11:30 pm    Post subject: Reply with quote

sinkfaze wrote:
Apparently the recorder isn't catching the whole window title...maybe this will work?


Code:
#include COM.ahk
#include iWeb.ahk
COM_CoInitialize()

$0::
Clipboard=
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}

tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window left Display
. . .


But why are you sending focus to the field to copy the data? You could use iWeb functions to copy the data straight out of the field:

Code:
lastname:=iWeb_getDomObj(pwb,"lastname")
;COM_Invoke(pwb, "document.all.item[lastname].focus"), ; Textbox to capture
;sleep 50
;Send, {CtrlDown}a{CtrlUp}{CtrlDown}c{CtrlUp}
;ClipWait, 0.2  ; wait 0.2 sec for copy operation to happen
. . .
iWeb_setDomObj(pwb,"ctl00xKxHxMAxFAxIAxgeslachtEdit_input", "man")
;COM_Invoke(pwb, "document.all.item[ctl00_K_H_MA_FA_IA_achterNaamEdit].focus"), ; Textbox to paste


Thank Thank Thank you!
i will test this right away

edit:

OH wait!!
I just use:
Code:
iWeb_setDomObj(pwb,"ctl00xKxHxMAxFAxIAxgeslachtEdit_input", "man")

to set a multiple option list to male.

Question is: how do i send
lastname from:
Code:
lastname:=iWeb_getDomObj(pwb,"lastname")

to??:
Code:
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", "")


I need clipboard?
Code:
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", clipboard)


or will this work?

Code:
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", pwb,"lastname")

_________________
The signature is away at the moment, please leave a message after the beep...
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 2427

PostPosted: Tue Nov 24, 2009 11:57 pm    Post subject: Reply with quote

Literal strings must be quoted, variables can be sent as is:

Code:
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit",lastname)

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
VibrantLife



Joined: 29 Oct 2009
Posts: 47

PostPosted: Wed Nov 25, 2009 12:45 am    Post subject: Reply with quote

Uhm.. i test these 2 scripts, but neither of one do something, On Winxp sp3 with IExplorer 7. What am i doin wrongż

Code:

#include COM.ahk
#include iWeb.ahk
COM_CoInitialize()

$0::
Clipboard=
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}

tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window left Display

lastname:=iWeb_getDomObj(pwb,"lastname")
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", lastname)

sleep 50

WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}
tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window left Display

firstname:=iWeb_getDomObj(pwb,"firstname")
iWeb_setDomObj(pwb,"document.all.item[ctl00_K_H_MA_FA_IA_roepNaamEdit", firstname)

COM_Release(objIE)
COM_Term()
return


It should switch between windows so i thought this might work but isn't :

Code:

#include COM.ahk
#include iWeb.ahk
COM_CoInitialize()

$0::
Clipboard=
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}
tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window left Display

lastname:=iWeb_getDomObj(pwb,"lastname")
sleep 50
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Invoeren persoon")
    break
}
tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window Right Display

iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", lastname)
sleep 50

Clipboard=
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}
tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window left Display

firstname:=iWeb_getDomObj(pwb,"firstname")
sleep 50
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Invoeren persoon")
    break
}
tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ;Window Right Display

iWeb_setDomObj(pwb,"document.all.item[ctl00_K_H_MA_FA_IA_roepNaamEdit", firstname)

COM_Release(objIE)
COM_Term()
return

_________________
The signature is away at the moment, please leave a message after the beep...
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 2427

PostPosted: Wed Nov 25, 2009 4:06 am    Post subject: Reply with quote

You need to put some error checks into the script and once you've used the window loop to identify the potentially vague window you shouldn't need to do it again:

Code:
#include COM.ahk
#include iWeb.ahk

$0::
Clipboard=
WinGet, iList, List, ahk_class IEFrame
errlvl=1
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ") {
    errlvl=0 ; sets errlvl to 0 so script will not error out
    break
  }
}
if (errlvl=1) { ; if window not found
  MsgBox, 48, Warning, the window loop was unable to locate the appropriate window.
  return
}

WinActivate, %tVar% ; if window found will
win:=RegExReplace(tVar," - Windows Internet Explorer")
COM_CoInitialize()
pwb:=iWeb_getWin(win) ;Window left Display
firstname:=iWeb_getDomObj(pwb,"firstname")
lastname:=iWeb_getDomObj(pwb,"lastname")
COM_Release(pwb)
WinActivate, Invoeren persoon
pwb:=iWeb_getWin("Invoeren persoon") ;Window Right Display
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_roepNaamEdit", firstname)
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", lastname)
COM_Release(pwb)
COM_CoUnInitialize()

return

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2294
Location: Louisville KY USA

PostPosted: Wed Nov 25, 2009 4:47 am    Post subject: Reply with quote

from the iweb library
Code:
iWeb_Activate(sTitle)
activates the window and tab of the tab matching the full or partial title
_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
VibrantLife



Joined: 29 Oct 2009
Posts: 47

PostPosted: Wed Nov 25, 2009 11:59 pm    Post subject: Reply with quote

tank wrote:
from the iweb library
Code:
iWeb_Activate(sTitle)
activates the window and tab of the tab matching the full or partial title


Tank!

What i need to do, or write code to get focus between
2 IExplorer Window Tab Title name's:

(Tabtitlename:)-> Contact:
(Tabtitlename:)-> Invoeren persoon

How do i trigger/fire that fine script?

I read "Change the condition here as appropriate!"
Like.how...I'm confused,
i need a small direction to digest the tutorial Shocked

Code:

iWeb_Activate(sTitle)
{
; thanks Sean
; http://www.autohotkey.com/forum/viewtopic.php?p=231093#231093
   DllCall("LoadLibrary", "str", "oleacc.dll")
   DetectHiddenWindows, On
;~    Winshow,% "ahk_id " HWND:=COM_Invoke(pwb:=iWeb_getwin(sTitle),"HWND")
;~    COM_Release(pwb)
   ;WinRestore,% "ahk_id " HWND
   WinActivate,% "ahk_id " HWND
   WinWaitActive,% "ahk_id " HWND,,5

   ControlGet, hTabBand, hWnd,, TabBandClass1, ahk_class IEFrame
   ControlGet, hTabUI  , hWnd,, DirectUIHWND1, ahk_id %hTabBand%

   If   hTabUI && DllCall("oleacc\AccessibleObjectFromWindow", "Uint", hTabUI, "Uint",-4, "Uint", COM_GUID4String(IID_IAccessible,"{618736E0-3C3D-11CF-810C-00AA00389B71}"), "UintP", pacc)=0
   {
      Loop, %   COM_Invoke(pacc, "accChildCount")
        If   paccChild:=COM_Invoke(pacc, "accChild", A_Index)
          If   COM_Invoke(paccChild, "accRole", 0) = 0x3C
          {
            paccTab:=paccChild
            Break
          }
          Else   COM_Release(paccChild)
      COM_Release(pacc)
   }
   If   pacc:=paccTab
   {
      Loop, %   COM_Invoke(pacc, "accChildCount")
        If   paccChild:=COM_Invoke(pacc, "accChild", A_Index)
          If   COM_Invoke(paccChild, "accName", 0) = sTitle   ; Change the condition here as appropriate!
          {
            COM_Release(pwb),VarSetCapacity(pwb,0),VarSetCapacity(HWND,0)
            COM_Invoke(paccChild, "accDoDefaultAction", 0)
            COM_Release(paccChild)
            Break
          }
          Else   COM_Release(paccChild)
      COM_Release(pacc)
   }
            WinActivate,% sTitle



When i try Tab Title Google:
Nothing happens.
Code:

#Include COM.ahk

iWeb_Activate(sTitle)
{
; thanks Sean
; http://www.autohotkey.com/forum/viewtopic.php?p=231093#231093
   DllCall("LoadLibrary", "str", "oleacc.dll")
   DetectHiddenWindows, On
;~    Winshow,% "ahk_id " HWND:=COM_Invoke(pwb:=iWeb_getwin(sTitle),"HWND")
;~    COM_Release(pwb)
   ;WinRestore,% "ahk_id " HWND
   WinActivate,% "ahk_id " HWND
   WinWaitActive,% "ahk_id " HWND,,5

   ControlGet, hTabBand, hWnd,, TabBandClass1, ahk_class IEFrame
   ControlGet, hTabUI  , hWnd,, DirectUIHWND1, ahk_id %hTabBand%

   If   hTabUI && DllCall("oleacc\AccessibleObjectFromWindow", "Uint", hTabUI, "Uint",-4, "Uint", COM_GUID4String(IID_IAccessible,"{618736E0-3C3D-11CF-810C-00AA00389B71}"), "UintP", pacc)=0
   {
      Loop, %   COM_Invoke(pacc, "accChildCount")
        If   paccChild:=COM_Invoke(pacc, "accChild", A_Index)
          If   COM_Invoke(paccChild, "accRole", 0) = 0x3C
          {
            paccTab:=paccChild
            Break
          }
          Else   COM_Release(paccChild)
      COM_Release(pacc)
   }
   If   pacc:=paccTab
   {
      Loop, %   COM_Invoke(pacc, "accChildCount")
        If   paccChild:=COM_Invoke(pacc, "accChild", A_Index)
          If   COM_Invoke(paccChild, "accName", 0) = Google   ; Change the condition here as appropriate!
          {
            COM_Release(pwb),VarSetCapacity(pwb,0),VarSetCapacity(HWND,0)
            COM_Invoke(paccChild, "accDoDefaultAction", 0)
            COM_Release(paccChild)
            Break
          }
          Else   COM_Release(paccChild)
      COM_Release(pacc)
   }
            WinActivate,% sTitle
}

_________________
The signature is away at the moment, please leave a message after the beep...
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2294
Location: Louisville KY USA

PostPosted: Thu Nov 26, 2009 12:18 am    Post subject: Reply with quote

um dont alter the function??? why would you do that
Code:
iweb_init()
iWeb_Activate("Contact")
sleep,2000
iWeb_Activate("Invoeren persoon")
iweb_term()

_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
VibrantLife



Joined: 29 Oct 2009
Posts: 47

PostPosted: Fri Nov 27, 2009 2:44 pm    Post subject: Reply with quote

tank wrote:
um dont alter the function??? why would you do that
Code:
iweb_init()
iWeb_Activate("Contact")
sleep,2000
iWeb_Activate("Invoeren persoon")
iweb_term()


Alright! Very Happy Tabswitching works perfectly

But the transport of the text from one to another tab is EXtremly slow
I also had to add:
Code:
pwb:=iWeb_getwin(" ")

Otherwise it wasn't copying anything.

I also tried to iwebinit/term @ every iwebactivate but doesn't speed it up.

Am i missing somethingż

Code:

#include COM.ahk
#include iWeb.ahk

COM_CoInitialize()

$0::
iweb_init()
iWeb_Activate("Contact: ")
pwb:=iWeb_getwin("Contact: ")            
lastname:=iWeb_getDomObj(pwb,"lastname"),

iWeb_Activate("Invoeren persoon")
pwb:=iWeb_getwin("Invoeren persoon")
iWeb_setDomObj(pwb,"ctl00xKxHxMAxFAxIAxgeslachtEdit_input", "man"),
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit", lastname),

iWeb_Activate("Contact: ")
pwb:=iWeb_getwin("Contact: ")
firstname:=iWeb_getDomObj(pwb,"firstname"),

iWeb_Activate("Invoeren persoon")
pwb:=iWeb_getwin("Invoeren persoon")
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_roepNaamEdit", firstname),

iWeb_Activate("Contact: ")
pwb:=iWeb_getwin("Contact: ")
middlename:=iWeb_getDomObj(pwb,"middlename"),

iWeb_Activate("Invoeren persoon")
pwb:=iWeb_getwin("Invoeren persoon")
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_tussenvoegselsEdit", middlename),

iweb_term()
COM_Release(objIE)
COM_Term()
return

_________________
The signature is away at the moment, please leave a message after the beep...
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2294
Location: Louisville KY USA

PostPosted: Fri Nov 27, 2009 5:54 pm    Post subject: Reply with quote

there is no need whatsoever to switch tabs using the iweb functions they work even if the tab isnt visible and IE is minimized
_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 2427

PostPosted: Fri Nov 27, 2009 6:19 pm    Post subject: Reply with quote

VibrantLife wrote:
Am i missing something?


Yes. As you said previously, the viewer isn't retrieving the full title of the Contact page, you need to get something that will get the correct page title for you:

Code:
#include COM.ahk
#include iWeb.ahk

$0::
iweb_init()
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}
tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar) ; instead of iWeb_getWin("Contact: ")
firstname:=iWeb_getDomObj(pwb,"firstname")
middlename:=iWeb_getDomObj(pwb,"middlename")
lastname:=iWeb_getDomObj(pwb,"lastname")
COM_Release(pwb) ; release pointer to Contact page
pwb:=iWeb_getwin("Invoeren persoon") ; create new pointer to 'Invoeren persoon'
iWeb_setDomObj(pwb,"ctl00xKxHxMAxFAxIAxgeslachtEdit_input",firstname)
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_tussenvoegselsEdit", middlename)
iWeb_setDomObj(pwb,"ctl00_K_H_MA_FA_IA_achterNaamEdit",lastname)
iWeb_Activate("Invoeren persoon")
COM_Release(pwb) ; instead of COM_Release(objIE)
iWeb_Term()
return

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
VibrantLife



Joined: 29 Oct 2009
Posts: 47

PostPosted: Sun Dec 06, 2009 6:51 pm    Post subject: Reply with quote

Great! I didn't know Com & iweb works so lightning fast.
It paste text instantly, simply amazing Very Happy i'm so happy with this!
Thanks guys!!

I still copy telephonenr's with clipboard.
Can this with Com & iweb also?

Something like:

Code:


$0::

iweb_init()
WinGet, iList, List, ahk_class IEFrame
Loop % iList {
  current:=iList%A_Index%
  WinGetTitle, tVar, ahk_id %current%
  if InStr(tVar,"Contact: ")
    break
}
tVar:=RegExReplace(tVar," - Windows Internet Explorer")
pwb:=iWeb_getWin(tVar)

telephone1:=iWeb_getDomObj(pwb,"telephone1") ; Get telephonenr1 split it in areacode and subscribercode with RegexReplace:

telephone1_Areacode := RegexReplace(telephone1, "^\s*\(?0*(\d+)\)?", "$1") ; without clipboard the tabs aren't needed, 't are tabs?
    StringReplace, telephone1_Areacode, telephone1_Areacode, -, %A_Space%, All
    StringReplace, telephone1_Areacode, telephone1_Areacode, %A_Space%,,All

telephone1_SubscrNr := RegexReplace(telephone1, "^\s*\(?0*(\d+)\)?", "$2")
    StringReplace, telephone1_SubscrNr, telephone1_SubscrNr, -, %A_Space%, All
    StringReplace, telephone1_SubscrNr, telephone1_SubscrNr, %A_Space%,,All

COM_Release(pwb)

pwb:=iWeb_getwin("Invoeren persoon")

iWeb_setDomObj(pwb,"igtxtctl00_K_H_MA_FA_IA_bereikbaarheid_TW_InvoerUserControl_landNrEdit", "31") ; = Landcode field, i just put landcode 31 in it

iWeb_setDomObj(pwb,"igtxtctl00_K_H_MA_FA_IA_bereikbaarheid_TW_InvoerUserControl_netNrEdit", telephone1_Areacode) ; paste First part of telephonenr1 Areacode

iWeb_setDomObj(pwb,"igtxtctl00_K_H_MA_FA_IA_bereikbaarheid_TW_InvoerUserControl_abonneeNrEdit", telephone1_SubscrNr) ; = paste second part of telephonenr1 subscribernr
iWeb_Activate("Invoeren persoon")
COM_Release(pwb)
iWeb_Term()
return


I think i need to leave tabs behind and split the RegexReplacecode in Two but i can't figure out which part where to use.



Landcodenr, Areacodenr, Subscribernr fields
_________________
The signature is away at the moment, please leave a message after the beep...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group