Help is needed with Set Widget Value action

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.

Update 2: I’ve added three js functions that can be run inside browser widget so your webapps can execute SambaPOS functions.

window.external.ExecuteAutomationCommand(<CommandName>,<CommandValue>);
window.external.GetSettingValue(<SettingName>);
window.external.SetSettingValue(<SettingName>,<SettingValue>);

I hope @JohnS notice that :slight_smile:

2 Likes

Wait a minute… so your saying the apps can execute Samba functions? As in I can control Samba through them as well as other way around? Is it possible to pass a value from the webapp as a CommandValue ?

If it runs in browser widget… Yes.

2 Likes

Holy cow I have had this idea for a while now I just thought it was going to be nearly impossible so Ive held back on requests… But now it suddenly all seems possible. It may take me a while to build it… but this means I can do some very advanced integration with TimeTrex. I can not wait to try this.

This fits perfect with my Employee entity design as well. Lots of cool stuff I can do to control those entities now.

Using the AHK method I already have built a few test functions. I have tested successfully making it check an Entity name when Time Clock is pressed to view the TimeTrex web app… it logs that specific entity into TimeTrex automatically. Its working great… my next test is automating TimeTrex to pull up specific Entities schedule…

dear @QMcKay,
I found the name of the enter button, but the Web page do not agree pressing enter to enter the site :frowning: and it displays an error message That username and Password is not correct
it enter only with a mouse click
It is possible to add a command button for mouse click?
of course It’s fine without it but if there is a way I’d love to.
Thanks in advance.

@pizzaeilat4, this should do it - just replace login-button with the name of the button you found…

page.Document.getElementById("login-button").Click()

@emre, excellent features - quite powerful. We might be able to do away with AHK altogether in this case!

It’s not so bad.
Even so, that’s fine, thank you very much :smiley:

@pizzaeilat4, try this instead of Click or Submit:

page.Document.getElementById("password").focus()
Send, {Enter}

It is a button but its not a button image from what I can tell it is a Text button… not sure what that means…

EDIT: Try

page.Document.getElementById("x-btn-click").Click()

EDIT: Nevermind I see that you got it working it was just not sending the right password

I am curious if you made sure you typed right password and login ? I am sure you did just thought I would double check.

I noticed you released these features with 4.1.63 today. I am going to play around with them. I like AHK but if I can do same thing internally without having to start process for a script and or call other libraries that would be great!

1 Like

TimeTrex uses a lot of JS I am playing around with the new functions. So far I have not gotten it to work yet but it looks like I may be able to access/control almost every aspect of TimeTrex and even pass values from TimeTrex all within SambaPOS. I may be able to make it almost as if TimeTrex is just part of SambaPOS.

Example would be instead of navigating TimeTrex from within the widget I could navigate it and perform functions with command buttons from SambaPOS and use some of the results with my Employee Entities to do some neat stuff. Instead of using (ENTITY STATE MINUTES:X} like I showed in a screenshot while back I could actually pull real data from the actual time clock as a command value and inject that command value to display in the Question portion of my ask question popup.

Hopefully I am smart enough to figure this all out haha.