 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tank
Joined: 21 Dec 2007 Posts: 2405 Location: Louisville KY USA
|
Posted: Fri Nov 20, 2009 1:43 am Post subject: |
|
|
k I have several pending updates to iWeb and the tool plus yours to merge and i intend to try to merge the idea Sinkfaze is exploreing into the gui somehow
I will wait and see how far he gets before doing that look for some code updates saturday
i intend on changeing the layout but all of the gui element names will remain the same  _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Fri Nov 20, 2009 2:06 am Post subject: |
|
|
| tank wrote: | | show me what your getting com errors with perhaps i"ll have an idea |
Well on my business computer I experienced no errors whatsoever. On my personal computer I was getting a "Name" error from my window loop function (which did not prevent it from working) and when I tried to execute script through the pipe I got a "LocationName" error from iWeb_getWin() (which also did not prevent it from working). _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2405 Location: Louisville KY USA
|
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Fri Nov 20, 2009 8:38 am Post subject: |
|
|
| tank wrote: | | try updating the iweb library i tinkered with it over the last day or so |
Or, as years in the trenches of tech support should've told me, I could restart my computer. I forgot that I use Firefox at home and when I ran the script pad the first time and pressed 'Initialize' I didn't have IE open (or any windows it could connect to, for that matter). Probably loaded the DLL into memory badly and Microsoft never unloaded it, so the error persisted until I rebooted.
What a pain, though. Something to keep in mind for the COM help file anyway.
I uploaded a revised version of the script pad with a dropdown list of the active windows and a refresh button to refresh the list as needed. Also added some Process, Exist commands to try to avoid the faulty COM calls.
EDIT: Just uploaded the latest revision again with slight fixes.
- Widened the dropdown menu to accommodate longer window title
- Corrected the initialization output from iWebgetWin to iWeb_getWin
I've also started a version history, the latest version is 0.2. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2405 Location: Louisville KY USA
|
Posted: Mon Nov 23, 2009 1:41 am Post subject: |
|
|
| sinkfaze wrote: | | I have uploaded a "script pad" GUI for testing purposes. Mostly I'm interested in making sure that the pad's functionality itself is solid. I think this could be a complimentary GUI to anchor to the recorder itself that will record the appropriate functions and give the user a place to test and even output their script. I've included brief explanations of the available options and a test script to try out. Have a look and see what you think. | cant download it link broken ?  _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2405 Location: Louisville KY USA
|
Posted: Mon Nov 23, 2009 4:14 am Post subject: |
|
|
The iWebBrowser2 Learner has been updated and now adds some finer detail and a very basic script writing tool which we will be building upon
I could not download Sinkfaze latest script version so i had to hope i did as well as he was doing.
As well the iWeb library has been updated and is in need of testing here is the current api list. The functions in red are the source of the most changes
iWeb_getwin supports a blank title which will capture the active window
iWeb_Checked should only be used on check boxes and radio buttons and will return the checked status of either checked=true
iWeb_SelectOption relies on a numeric value for selected
iWeb_TableParse allows you to enter table information table row and cell each allows name id and 0 based index. If the cell reference is invalid Error level is set allowing things like the following to be done without knowing for sure which cells are valid
| Code: | m:=iWeb_TableParse(tdata,"tblResults",A_Index,1) "|" ; b
If ErrorLevel
break |
The download links are on the first page
| Code: | iWeb_Init()
iWeb_Term()
iWeb_newIe()
iWeb_Model(h=550,w=900)
iWeb_getwin(t)
iWeb_nav(pwb,url)
iWeb_complete(pwb)
iWeb_DomWin(pDisp,frm="")
iWeb_getDomObj(pwb,obj,frm="")
iWeb_inpt(i)
iWeb_Checked(pwb,obj,checked=1,sIndex=0,frm="")
iWeb_FireEvents(ele)
iWeb_SelectOption(pDisp,sName,selected,method="selectedIndex",frm="")
iWeb_TableParse(pDisp,table,row,cell,frm="")
iWeb_TableLength(pDisp,TableRows="",TableRowsCells="",frm="")
iWeb_clickDomObj(pwb,obj,frm="")
iWeb_clickText(pwb,t,frm="")
iWeb_clickHref(pwb,t,frm="")
iWeb_clickValue(pwb,t,frm="")
iWeb_setDomObj(pwb,obj,t,frm="")
iWeb_execScript(pwb,js,frm="")
iWeb_getVar(pwb,var,frm="")
iWeb_striphtml(txt)
iWeb_escape_text(txt)
iWeb_Txt2Doc(t)
iWeb_Activate(sTitle) |
_________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Mon Nov 23, 2009 6:40 am Post subject: |
|
|
| tank wrote: | cant download it link broken ?  |
In my last post I switched to a version history and forgot to update the prior post to the latest version. That has been corrected.
I tried testing the "type" call from COM_Invoke over the weekend and while it does determine the proper INPUT tags it was a little difficult for me to decide when to call it (and errors because of my bad judgment for when to call are a huge pet peeve for me). If you think the Accessibility is too wieldy I'll gladly go along with your recommendation but you might need to handle the call creation in that hotkey.
I noticed you've created the calls to table elements, which is fantastic, but your example made me pause:
| Code: | m:=iWeb_TableParse(tdata,"tblResults",A_Index,1) "|" ; b
If ErrorLevel
break |
Tables/rows/cells are accessed based on a zero-based index, correct? I double-checked the code and there doesn't seem to be anything in place that would prevent such a sample looping script from skipping the first available table/row/cell in every instance.
So since I might be missing something, does the Learner have a way to return the table/row/cell under the mouse, as a number or otherwise? If it does, will it return any numeric location as a zero-based entry?
This is obviously where working with tables might be a little tricky since, if we're returning zero-based numbers, the user has to understand that to return table elements in a loop starting with the first element that they must do this:
| Code: | m:=iWeb_TableParse(tdata,"tblResults",A_Index-1,1) "|" ; b
If ErrorLevel
break |
By the way, I went ahead and tightened up the code for the hotkey, it has been tested as good on my end, you're free to test it and amend your existing code if you feel this is sufficient:
| Code: | ^e::
Gui, Submit, NoHide
if theFrame {
Pos=1
While Pos:=RegExMatch(theFrame,"is)sourceIndex]=(.*?) \*\*\[name]= (.*?) \*\*\[id]= (\V*)",f,Pos+StrLen(f))
fpath.=((f1) ? (f1) : ((f3) ? (f3) : (f2))) . (A_Index=1 ? "" : ",")
}
oFrm:=fpath ? ",""" fpath """" : ""
dObj:=((EleName) ? (EleName) : ((EleIDs) ? (EleIDs) : (EleIndex)))
pacc := iWebacc_AccessibleObjectFromPoint()
oState:=((paccChild:=iWebacc_Child(pacc, _idChild_)) ? iWebacc_State(paccChild) : iWebacc_State(pacc,_idChild_))
oRole:=((paccChild:=iWebacc_Child(pacc, _idChild_)) ? iWebacc_Role(paccChild) : iWebacc_Role(pacc,_idChild_))
oName:=((paccChild:=iWebacc_Child(pacc, _idChild_)) ? iWebacc_Name(paccChild) : iWebacc_Name(pacc,_idChild_))
oValue:=((paccChild:=iWebacc_Child(pacc, _idChild_)) ? iWebacc_Value(paccChild) : iWebacc_Value(pacc,_idChild_))
res.=((InStr(link,RegExReplace(oState,"\h+.*"))) ? "iWeb_clickDomObj(pwb,""" dObj """" oFrm ")`n"
. ((oName) ? "iWeb_clickText(pwb,""" oName """" oFrm ")`n" : "")
. ((oValue) ? "iWeb_clickHref(pwb,""" oValue """" oFrm ")" : "")
: ((HTMLTag="INPUT" && InStr(altinpt,oRole)) ? "iWeb_clickDomObj(pwb,""" dObj """" oFrm ")`n"
. ((oName) ? "iWeb_clickText(pwb,""" oName """" oFrm ")`n" : "")
. ((oValue) ? "iWeb_clickHref(pwb,""" oValue """" oFrm ")" : "")
: ((InStr(oRole,"editable") && InStr(getRole,RegExReplace(oState,"\h+.*"))) ? "iWeb_getDomObj(pwb,""" dObj """" oFrm ")"
: ((HTMLTag="INPUT" && !InStr(altinpt,oRole) && (oRole <> "push button") ? "iWeb_setDomObj(pwb,""" dObj """" oFrm ")"
: ((HTMLTag="INPUT" && oRole="push button" && !EleName && !EleIDs) ? "iWeb_clickValue(pwb,""" oName """" oFrm ")`n"
. "iWeb_clickDomObj(pwb,""" EleIndex """" optFrames ")"
: ((HTMLTag="SELECT") ? "iWeb_setDomObj(pwb,""" dObj """" oFrm ")"
: "iWeb_getDomObj(pwb,""" dObj """" oFrm ")")))))))
MsgBox % res
VarSetCapacity(res,0), VarSetCapacity(fpath,0)
return |
Ternary is like crack after a while. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
jethrow
Joined: 24 May 2009 Posts: 778 Location: Iowa, USA
|
Posted: Mon Nov 23, 2009 9:07 am Post subject: |
|
|
I like the new GUI - especially the addition of tabs. A couple things, however, that I personally liked about the old GUI were the Element Tag Name listing, and the frames being on multiple lines. Also, if the broswer information is going to be shown (specifically position and size), I think it should be updated regardless of if the curser is over the web page document or not (perhaps even if the program is paused). Overall though, it looks sharp.
I made a few changes to the Element Outline GUI support:- Outline GUIs will be removed if window HWND stays the same, but the window either moves, changes size, or changes WinTitle
- The Outline GUI's window Z-order will be set to directly below the window that is directly above the window accessed by the IE_HtmlElement() function (rather than set to an Always-On-Top status)
I updated my link - however, the scripts in the iWebBrowser2 Learner download didn't reflect the current build. So I extracted the script from the .exe file. This caused all the previous comments to be deleted.
Also, and this is purely IMO, this program should be a tool to gather information about webpages, with the additional awsome functionality of recording & creating scripts. What I'm getting at is I think we should make the GUI narrower (like AHK Window Info 1.7 or Window Spy), and have the Script Writer be a separate pop-up ToolWindow. What are other people's thoughts\opinions? (I could come up with a sample GUI, but I would like opinions before I spend that time) _________________ AHKL, COM_L,Webpage Controls,Donate to AHK |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Mon Nov 23, 2009 7:12 pm Post subject: |
|
|
| jethrow wrote: | | I like the new GUI - especially the addition of tabs. A couple things, however, that I personally liked about the old GUI were the Element Tag Name listing, and the frames being on multiple lines. Also, if the broswer information is going to be shown (specifically position and size), I think it should be updated regardless of if the curser is over the web page document or not (perhaps even if the program is paused). |
Agreed.
| jethrow wrote: | | Also, and this is purely IMO, this program should be a tool to gather information about webpages...I think we should make the GUI narrower (like AHK Window Info 1.7 or Window Spy), and have the Script Writer be a separate pop-up ToolWindow. |
Also agreed. I like the concept of a more comprehensive all-in-one tool but I think moving between tabs will ultimately be more annoying than moving between windows since windows can be handled more flexibly code-wise.
BTW tank, I noticed another potentially problematic web page issue: input elements with the same name on the same page, but with different forms and types. Obviously, the Learner will capture info about the text input of some particular name without taking heed of a hidden input of that name that may exist before it, so when the user tries to run the code and that hidden input exists, iWeb_setDomObj() will attempt to set that element first and they'll probably receive a "tagName" error. Do we have any way to have iWeb_setDomObj() check the type of input found and if it isn't type "text" to keep looking? _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2405 Location: Louisville KY USA
|
Posted: Mon Nov 23, 2009 8:36 pm Post subject: |
|
|
| sinkfaze wrote: | Also agreed. I like the concept of a more comprehensive all-in-one tool but I think moving between tabs will ultimately be more annoying than moving between windows since windows can be handled more flexibly code-wise.
BTW tank, I noticed another potentially problematic web page issue: input elements with the same name on the same page, but with different forms and types. Obviously, the Learner will capture info about the text input of some particular name without taking heed of a hidden input of that name that may exist before it, so when the user tries to run the code and that hidden input exists, iWeb_setDomObj() will attempt to set that element first they'll probably receive a "tagName" error before then. Do we have any way to have iWeb_setDomObj() check the type of input found and if it isn't type "text" to keep looking? |
first thing first writer as a separate tool
to this i would respond wouldnt a script writer rely in the same functionality and essentually have to have the viewer as part of it?
to the multiple instances of an element
this is why i try to refrain from using the name attribute and only put it back in after you brought it up the other day. ID should be unique as well as index
You may have noticed the form tab to which i plan listing each form within a document as well as all form elements and any assigned events
as well a line to show the post data
allow the user to save a script that would assign current values and submit the form as well.
These complications are the reason that i often still use COM_Invoke much of the time. its also why i chose to make the page source for the active document visible as well
I intent to add some funcitonality to search it but havent decided what other functionality i might add to that perhaps the following
list box with
every element along with its sourceindex
another listview with every element that has an ID
and a listview with all named elements.
Perhaps if i feel especially silly i shall allow a listview with a user configureable tagname and then list each item with that tag with a sampling of the text. I can think of dozens of times when such would have been usefull to me
The templates page is intended to create a generic script that without element specifics demonstrates which function calls are needed and a sample structure for the code
the scriptwriter is just a tool to create a test script and test code
I would like to merge QuickAHK v1.0 for the textbox of the sample script _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
jethrow
Joined: 24 May 2009 Posts: 778 Location: Iowa, USA
|
Posted: Tue Nov 24, 2009 5:32 am Post subject: |
|
|
I updated my script/link such that the outline will move if the IE window is moved (rather than removing the outline).
| tank wrote: | | I would like to merge QuickAHK v1.0 for the textbox of the sample script | I like it
EDIT - Also, I added the variable GuiWinTitle for the main Gui WinTitle (above first GUI, Show command). I thought this would be beneficial in case we need to use this name throughout the script, such as the ^/ hotkey. _________________ AHKL, COM_L,Webpage Controls,Donate to AHK |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Tue Nov 24, 2009 7:46 am Post subject: |
|
|
Hmmm...I'm not sure I'd be in favor of that change for a couple of reasons:
- Using jballi's creation puts an additional burden on us to understand how his program works and support it in the event that some future update of AHK causes a conflict. jballi is an AHK wizard but he visits the forums sporadically and he may not necessarily update QuickAHK (or notify the forum that he has updated it) when he does visit. Granted, he usually does update his scripts and notifies the forum as such but we cannot rely on his assistance for our modifications of his creation.
Adding this makes him an (unwitting?) party in the project which could put us all in difficult spots when people ask us questions about his QuickAHK and people potentially ask him questions about our Learner.
- I think a tool like QuickAHK is a little beyond the grasp of the audience we're targeting. And there's no offense intended to jballi at all, but I think a user similar to his skill level is not the type of user we would (or should) expect to be using the Learner. We're trying to de-mystify web automation to a group of people for whom automation in general is probably a bit mystifying, and providing a script tester/recorder that overwhelms them kind of defeats the purpose.
My personal opinion is that we're better off trying to find ways to create our own recorder that emphasizes simple execution over robust features.
| tank wrote: | | wouldnt a script writer rely on the same functionality and essentially have to have the viewer as part of it? |
A script writer doesn't have to have access to the same functionality as the viewer, but it does have to have access to the same output. And the writer can be part of the same script, I just think it will ultimately be better as a separate GUI window.
I was chewing on the source for the Learner again today, let me see if I can throw together a conceptual script that integrates writer and learner as separate windows. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2405 Location: Louisville KY USA
|
Posted: Tue Nov 24, 2009 8:03 am Post subject: |
|
|
I agree its a bit large but cant you see how all we need to do is actually send the text of the script to it and have a very useable ahk script writing environment that we dont have to support really. Does fincs support everything he includes in Scite ?? i dont think he does but i could be wrong.
i like the syntax highlighting but I am not bent on this If i add such it wouldnt be till near the end of this deveopment so if we find something with some simple syntax highlighting im open to it _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2694 Location: the tunnel(?=light)
|
Posted: Tue Nov 24, 2009 7:08 pm Post subject: |
|
|
What is the purpose of iWeb_FireEvents? Ever since I updated to your latest version of the iWeb functions I get a ton of "onfocus", "onblur", "onclick" and/or "onchange" errors in scripts that were previously error-free. I'm assuming the addition of iWeb_FireEvents to the other functions is the cause of this?
I tried uncommenting COM_Error(0) in iWeb_FireEvents to no avail. I also tried commening out the added sections referring to iWeb_FireEvents inside the functions with no luck. The only thing that seems to work is to add COM_Error(0) before calling each function and adding that to my scripts a hundred times strikes me as an ugly way to upgrade. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2405 Location: Louisville KY USA
|
Posted: Tue Nov 24, 2009 7:15 pm Post subject: |
|
|
yea i forgot and left COM_Error(0) commented out
essenually some forms rely on events to perform actions enabling othe elements performing validation etc
I'll post an update to the code to prevent errors this evening sometime sorry for the confusion _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|