[Editor] Browser Automation Macro Editor (TagIE)

Post your working scripts, libraries and tools
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

27 Nov 2018, 15:45

Uploaded new release: added TagIE_Social_Sharing.ahk, for social media sharing, ready and simple to use, for your marketing... :D
For Now: only multiple Facebook groups and LinkedIn. Like this:

Code: Select all

;*************Post on LINKEDIN**************
linkedinprof(Link)

;*************Post on various FACEBOOK groups**************
fbgroup(Link, "keyword")
See an example here (Re-publishing my blog posts randomly on socials...)
You need to download last version of TagiE before

I will add further socials like tumblr, reddit, ycombinator...etc in next week. Please try it, report issues, propose yours...
Last edited by adegard on 28 Nov 2018, 01:18, edited 1 time in total.
burque505
Posts: 1301
Joined: 22 Jan 2017, 19:37

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 04:01

Hi, I tweaked the code a little - auto highlighting. Kind of nice to be able to paste the selector without manually selecting an element.
If it's acceptable, I'll do the rest of the groups (only IE Browsing group for now).
All I did was use ControlFocus, Edit1, then Send, then send left arrows, shift down, right arrows, shift up. Not much to it. Below is sample code.

Code: Select all

tnav:
    GuiControlGet, sCurrentText,, MainEdit
    ControlFocus, Edit1
    Send, {End}`ntnav("https://www.google.com/",""){Left 20}{Shift Down}{Right 14}{Shift Up}
return
Spoiler
Element_Highlighting.gif
Element_Highlighting.gif (422.01 KiB) Viewed 3340 times
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 04:43

Excellent @burque505! :bravo:

To best honest: I was trying to do the same, but with Clipboard and Ctrl ^v but on button, it didn't work...

Great also the "to go to next line" and highlighting parameters ... Simple good trick I didn't know.
For sure is more than "acceptable", if you'll be kind to adapt it to other button I'll thank you again...
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 08:09

Neat,it's more convenient if you pack the examples within the github repo though.
live ? long & prosper : regards
burque505
Posts: 1301
Joined: 22 Jan 2017, 19:37

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 12:33

Good though, CyLON! I´ll try to get up to speed with github so I can maybe fork it and do pull requests. Beyond me at the moment, though :facepalm:
Here's another attempt that gets rid of the problem with 'tsnap' and gets through the IE Browser and Chrome groups. I haven't tackled any of the scripts available from the menu, not sure if I should.
Spoiler
Obligatory GIF:
Element_Highlighting_2.gif
Element_Highlighting_2.gif (213.11 KiB) Viewed 3311 times
User avatar
kczx3
Posts: 1101
Joined: 06 Oct 2015, 21:39

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 13:14

burque505 wrote:
28 Nov 2018, 04:01
Hi, I tweaked the code a little - auto highlighting. Kind of nice to be able to paste the selector without manually selecting an element.
If it's acceptable, I'll do the rest of the groups (only IE Browsing group for now).
All I did was use ControlFocus, Edit1, then Send, then send left arrows, shift down, right arrows, shift up. Not much to it. Below is sample code.
I'd recommend using messages to do this instead of sending arrows. Use EM_GETSEL after the button is clicked to get the caret position and then use EM_SETSEL with proper offsets of the current position to set the selection in the control.

EM_GETSEL
EM_SETSEL
burque505
Posts: 1301
Joined: 22 Jan 2017, 19:37

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 13:44

Thanks, kczx3, that looks useful for other things I'm fiddling with also. I'll see if I can come up with something.
I notice from the docs that it'll work with Rich Edit controls, which will definitely be useful. It'll take me a while, no doubt, as I haven't yet made any significant use of messages (other than pasting in other people's code to my scripts).
Regards,
burque505

Edit: Using EM_GETSEL and EM_SET_SEL definitely works, but there is a lot more code.
I'm trying to split it up, so far I've got these sections that actually work. There is some flickering, but it does seem a little faster for sure. Probably worth it, even if I have to do it without functions.
By the way, pinvoke.net is another great place for constants. I should have thought to look there before. First category on the left.

Code: Select all

tnav:
    GuiControlGet, sCurrentText,, MainEdit
    ControlFocus, Edit1
    ControlGet, hCtl, Hwnd,, Edit1, A
    VarSetCapacity(vPos1, 4), VarSetCapacity(vPos2, 4)
    Send, {End}`ntnav("https://www.google.com/","") ; {Left 20}{Shift Down}{Right 14}{Shift Up}
    SendMessage, 0xB0, % &vPos1, % &vPos2,, % "ahk_id " hCtl ;EM_GETSEL := 0xB0 ;(left, right)
    vPos1 := NumGet(&vPos1, 0, "UInt"), vPos2 := NumGet(&vPos2, 0, "UInt")
    nPos1 := vPos2 - 20
    nPos2 := vPos2 - 6
    SendMessage, 0xB1, %nPos1%, %nPos2%,, % "ahk_id " hCtl

return
This segment works fine, but it will require lots of cutting and pasting if I don't split it up into functions I can call. Maybe I'm better off just doing the cutting and pasting, though. Here it is with one function, at least :)

Code: Select all

tnav:
    GuiControlGet, sCurrentText,, MainEdit
    ControlFocus, Edit1
    ControlGet, hCtl, Hwnd,, Edit1, A
    VarSetCapacity(vPos1, 4), VarSetCapacity(vPos2, 4)
    Send, {End}`ntnav("https://www.google.com/","") ;
    ControlGet, hCtl, Hwnd,, Edit1, A
    VarSetCapacity(vPos1, 4), VarSetCapacity(vPos2, 4)
    SendMessage, 0xB0, % &vPos1, % &vPos2,, % "ahk_id " hCtl ;EM_GETSEL := 0xB0 ;(left, right)
    vPos1 := NumGet(&vPos1, 0, "UInt"), vPos2 := NumGet(&vPos2, 0, "UInt")
    nPos1 := vPos2 - 20
    nPos2 := vPos2 - 6
    SetText(nPos1, nPos2)
    
    ; ....
    
    SetText(startPos, endPos) {
    ControlGet, hCtl, Hwnd,, Edit1, A
    VarSetCapacity(vPos1, 4), VarSetCapacity(vPos2, 4)
    SendMessage, 0xB0, % &vPos1, % &vPos2,, % "ahk_id " hCtl ;EM_GETSEL := 0xB0 ;(left, right)
    vPos1 := NumGet(&vPos1, 0, "UInt"), vPos2 := NumGet(&vPos2, 0, "UInt")
    nPos1 := startPos
    nPos2 := endPos
    SendMessage, 0xB1, %nPos1%, %nPos2%,, % "ahk_id " hCtl
}

return
So I tried to split it up still more, since that worked, but I'm creating a Frankenstein's monster. Obviously none of this is going to work outside the main script, but it does work.

Code: Select all

tnav:
   ; This first function was to be (hopefully something I can use at some point to shorten it.
   ; For now, I may end up just cutting and pasting the code that works.
   ; I think I've reached a point of diminishing returns.
    Prep1()
    Send, {End}`ntnav("https://www.google.com/","") ;
    ControlGet, hCtl, Hwnd,, Edit1, A
    VarSetCapacity(vPos1, 4), VarSetCapacity(vPos2, 4)
    SendMessage, 0xB0, % &vPos1, % &vPos2,, % "ahk_id " hCtl ;EM_GETSEL := 0xB0 ;(left, right)
    vPos1 := NumGet(&vPos1, 0, "UInt"), vPos2 := NumGet(&vPos2, 0, "UInt")
    nPos1 := vPos2 - 20
    nPos2 := vPos2 - 6
    SetText(nPos1, nPos2)
    
    ;.....
    
    Prep1() {
    GuiControlGet, sCurrentText,, MainEdit
    ControlFocus, Edit1
    ControlGet, hCtl, Hwnd,, Edit1, A
    VarSetCapacity(vPos1, 4), VarSetCapacity(vPos2, 4)
}
    ; ....
    
    SetText(startPos, endPos) {
    ControlGet, hCtl, Hwnd,, Edit1, A
    VarSetCapacity(vPos1, 4), VarSetCapacity(vPos2, 4)
    SendMessage, 0xB0, % &vPos1, % &vPos2,, % "ahk_id " hCtl ;EM_GETSEL := 0xB0 ;(left, right)
    vPos1 := NumGet(&vPos1, 0, "UInt"), vPos2 := NumGet(&vPos2, 0, "UInt")
    nPos1 := startPos
    nPos2 := endPos
    SendMessage, 0xB1, %nPos1%, %nPos2%,, % "ahk_id " hCtl
}
    
    

return
I'm definitely open to all suggestions, this is new ground for me.
Last edited by burque505 on 28 Nov 2018, 20:07, edited 1 time in total.
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 14:42

Thanks for comments, I'm not sure to anderstand (due to my poor english and also ahk knowledges)

@CylON: do you speak about examples of Gist.
@burque505: is there a way to add you as collaborator (and who is interested) on Github to make some release or fork ?(also on this I'm...limited)

Thanks, have a good night (sorry afternoon)
burque505
Posts: 1301
Joined: 22 Jan 2017, 19:37

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 15:07

@adegard, I'll try to get up to speed on Github so I can do that. I might be short of time until the weekend, but I look forward to it.
Regards,
burque505
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 15:48

@burque505, fine! sure, all time you need, no emergency. I continue to work on it. After, if you want you, you could make any changes.
I really appreciate your effort. Also from all other people of this good forum :thumbup:
burque505
Posts: 1301
Joined: 22 Jan 2017, 19:37

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 16:01

@adegard, very kind of you. Thanks.
Regards,
burque505
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Re: [Editor] Browser Automation Macro Editor (TagIE)

28 Nov 2018, 22:18

adegard wrote:
28 Nov 2018, 14:42
@CylON: do you speak about examples of Gist.
Thanks, have a good night (sorry afternoon)
Yes,i tend to clone repos's that i find useful so it's more intuitive that way,and others can even contribute examples to your repo where as only you can post to your gist... & good morning to you...
live ? long & prosper : regards
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

29 Nov 2018, 02:49

@burque505 @kczx3 :
Thanks for your effort, then as @burque505 said
Using EM_GETSEL and EM_SET_SEL definitely works, but there is a lot more code.

At this point, isn't it quicker and shorter to use inputbox or some pretty cocobelgica's entryform ? :think:


@CylON: Good Idea! I created the repo with all examples: HERE :dance:
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

30 Nov 2018, 05:41

New Release uploaded:
- improved code insertion as @burque505 first solution (but without auto auto highlighting for now):

Code: Select all

ControlFocus, Edit1
    Send, {End}`ntnav("https://www.google.com/","")
- Added iMacros code converter to "speed up Macro creation in TagIE (find it in MENU > Tools) : :dance:
Image
To record an iMacros:
-use chrome or Firefox extention (free), use Use CSS selectors Settings
-copy your code and convert it for TagIE with the tool
-modify your code as needed: loops, etc in TagIE editor

:arrow: DEMO VIDEO
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

30 Nov 2018, 09:34

For now, imacros converter support conversion of:

URL GOTO= ----> tnav
TAG SELECTOR="selector" CONTENT=value ----> tenter
TAG SELECTOR="selector" CONTENT=YES ----> tclick (reproduce check checkbox)
TAG SELECTOR="selector" ---->tclick
leosouza85
Posts: 39
Joined: 22 Jul 2016, 16:28

Re: [Editor] Browser Automation Macro Editor (TagIE)

30 Nov 2018, 15:06

Wonderful work!!! Really hope that someday it will work with frames and multilevel frames :-D
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

30 Nov 2018, 15:23

leosouza85 wrote:
30 Nov 2018, 15:06
Wonderful work!!! Really hope that someday it will work with frames and multilevel frames :-D
I'm happy you like it! Could you give me an example for of works to do with frames and multilevel frames, so I can work on it... (and understand myself)
leosouza85
Posts: 39
Joined: 22 Jul 2016, 16:28

Re: [Editor] Browser Automation Macro Editor (TagIE)

30 Nov 2018, 17:42

for example, some sites we have to do something like this to access elements in frames we cannot access directly via a pointer to the web browser... joe glines have excelent videos about this... the code looks like this:

frame := ComObj(9,ComObjQuery(pwb.document.All("WA1").contentwindow,"{332C4427-26CB-11D0-B483-00C04FD90119}","{332C4427-26CB-11D0-B483-00C04FD90119}"),1)
frame.document.getElementById("F_66").value := "User"


some mouse event that look like this
frame.rb89(evt := frame.document.getElementById("B_89"))
frame.rohk89()

I will send you the web site that I use this code via private message (it is a old code maybe it dont work anymore, as I use "findtext()" function to do the work... but ComObj is the "right way" :-D
User avatar
adegard
Posts: 89
Joined: 24 Nov 2017, 05:58
GitHub: adegard

Re: [Editor] Browser Automation Macro Editor (TagIE)

01 Dec 2018, 04:57

@leosouza85,
ok I will add a TagIE function for that... Give me some days
I think it's possible also to record frames levels in iMacros. Then it could be much easier to pass it to tagIE with selectors already done. :P

Return to “Scripts and Functions”

Who is online

Users browsing this forum: evilC, quietdolphin900 and 56 guests