Help is needed with Set Widget Value action

@QMcKay,
Yes yes yes yes it works
Wow thank you thank you thank you thank you :smiley:
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

1 Like

@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 :wink: )
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ā€¦

2 Likes

try

page.Document.getElementById("ext-gen25").Click()
1 Like

@QMcKay,
You are the King :blush:
Thank you so much and good night

1 Like

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

2 Likes

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.

:blush:

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! :stuck_out_tongue_winking_eye:

1 Like

Better is good :smile:

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 from Automation > Scripts by handler and injects it into html. So you can execute it with Invoke Script.

We can determine which widget to execute by itā€™s name.

2 Likes

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 :stuck_out_tongue:

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.

2 Likes

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.