@QMcKay,
Yes yes yes yes it works
Wow thank you thank you thank you thank you
Now there is the possibility of adding enter?
LOL, I canāt even get your page to load in the Widget whether I set it in the Widget or Navigate with the code⦠it just freezes with that progress barā¦
The script he posted does the log in as well. You just need to find the ID of it⦠and if its a button or not.
Example for mine (TimeTrex) I had to change the script
page.Document.getElementById(āloginFormā).Submit()
to
page.Document.getElementById(ālogin_btnā).Click()
Notice both Submit and LoginForm I had to change
@QMcKay It happens to me on the computer at home
I think it was caused by all the attempts we made (Iād be happy if you find why this is happening )
But on the other computer it works great
Thanks @kendash , Iāll try it
I use firefox so to find the ID i simply right clicked button and chose inspect element. Or you can do it old school and just view the source but i like the easy way myself.
Itās not letting me like your post anymore I am disappointed. I was going to throw out 3 more likes.
The issue is I canāt find the name of the form in the page (if may just be āformā). But it has a button called login-button
which should work if you call the Click()
methodā¦
try
page.Document.getElementById("ext-gen25").Click()
@QMcKay,
You are the King
Thank you so much and good night
We should so turn this into a tutorial haha. Little sloppy conversation but I am sure someone can use this discussion. This is a great example of integrating AHK with Samba and HTML widget. Ive used AHK in the past and ive watched it evolve into something extremely elaborate. Its nice we could use it for this.
It had been a while since I really looked at AHK so I did not realize the original website is not ran by the main developers anymore. That was good information to find out about http://ahkscript.org
wow wow wow⦠I was planning to extract a simple keystroke sender action from custom keyboard functions but after seeing the solution I understood that should be done through DOM. Great solutionā¦
page.Document.getElementById(āusernameā).Value := āyourusernameā
page.Document.getElementById(āpasswordā).Value := āyourpasswordā
page.Document.getElementById(āloginFormā).Submit()
While reading it Iāve remembered something. Iām not sure if it is possible wtih that widget but I think we should be able to execute javascript on loaded html files. I mean we can automate it with SambaPOS. If you think such feature can be useful I can check if it is possible.
AHK does support this, I saw it somewhere in my searching, something like:
page.execScript("<Javascript Code>")
You never know how useful it could be until we see it. If implementation isnāt difficult, let us know some possibilities.
It sounds very useful. I can not directly think of a use right this minute but that also does not mean that I wouldnāt use it if I knew what was possible.
Case and point⦠I had given up on AHK over a month ago because I couldnāt get this to work. Now that it does work I definitely see how useful it is.
I will split this into a Tutorial, specific to AHK
and HTML Viewer Widget
. I donāt need this now - I saw it as a challenge and an opportunity to learn something new - but I may need it in the future.
On the other hand, if @emre lets us use JavaScript in the HTML Viewer Widget, it will probably all be moot, and⦠BETTER!
Better is good
OK. Iāve changed sambamarket.com background color via actions and rules. I think that proves the idea.
What weāll have ?
- Html Widget Document Loaded Rule. Gives us url.
- Invoke Script action. That executes a js script by itās name that exists in a html page. For example if your page contains a
Test
function this action executes it. - and⦠the nasty
Inject Script
action. This action reads a script fromAutomation > Scripts
by handler and injects it into html. So you can execute it withInvoke Script
.
We can determine which widget to execute by itās name.
I could definitely use that. It allows me to do some things I wanted to do with TimeTrex for sure. And it more than likely will allow me do things I need that I have not realized yet
Update: Iāve also added basic support for parameters so weāll be able to pass values into scripts.
it accepts color
parameter.
and we add parameter like that. I think weāll be able to use printing tags here.
It changes to blue.
@QMcKay Thank you very much for the inspiration. I can imagine how weāll be able to improve that to create amazing integrations.
I am already prepping some stuff for my TimeTrex integration. I am thinking automating a lot of cool stuff. I am right now planning on paper an integration that will allow me to use Samba to enter schedules for my employees that will get sent to Timetrex. Each employee will be able to view their own schedule through SambaPOS.
I am also preparing to allow them to request time off through SambaPOS and it will send it to TimeTrex. So I am definitely interested in this. Very cool to know this is possible.