Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling next menu item
#1
In my toolbars and menus I have many macros that automatically insert Username and Password. They have this structure:
Code:
Copy      Help
Menu 1 :key "Username"; wait 0 ML; key "Password"

This way I can quickly insert passwords just by clicking on their field.
Sometimes it happens that websites require me to repeat or confirm just the username or just the password. So, for these cases, I have written multiple menu items (or toolbar buttons) with this structure:

Code:
Copy      Help
Menu 1 :key "Username"; wait 0 ML; key "Password"
Menu 2 :key "Username"
Menu 3 :key "Password"

Sometimes websites require me to update passwords. The problem is that in these cases I could forget to update all menu items (or toolbar buttons). In some cases I tried to solve this problem by creating separate shared macros, for example, a macro "Username" and a macro "Password", this way:
Code:
Copy      Help
Menu 1 :mac "Username"; wait 0 ML; mac "Password"
Menu 2 :mac "Username"
Menu 3 :mac "Password"

This way I need to keep updated just the shared macros. But this makes me creatig a lot of separate, different macros.
I think that a good solution would be the possibility to call next menu items (or toolbar buttons) from the previous one, in a structure like this one:
Code:
Copy      Help
Menu 1 :(execute 1st following menu item); wait 0 ML; (execute 2nd following menu item)
Menu 2 :key "Username"
Menu 3 :key "Password"

A possible solution could be the one described in this thread, but I would need a simple, single line, command, that would just call the next 1st or 2nd menu item.

Calling a specific line in a menu o toolbar macro would not be a good solution because, if I will add a menu items, all line numbers would change and consequently all calls would need to be updated.

What could be a better solution?
#2
Function KeyUserPassword
Code:
Copy      Help
;/
function $username $password

int action=3
sel GetMod
,case 0
,case 2
,action=ShowMenu("1 Only username[]2 Only password[]Cancel")
,if(action=0) ret

if(action&1) key (username)
if(action=3) wait 0 ML
if(action&2) key (password)

example menu or toolbar
Toolbar Toolbar2
Code:
Copy      Help
Help :mes "Ctrl+click menu item to enter only username or password." "" "i" * info.ico
Menu 1 :KeyUserPassword "Username1" "Password1"
Menu 2 :KeyUserPassword "Username2" "Password2"
#3
Fantastic!
#4
I would like, if possible, a different way of using this function.

- The menu that appears on Ctrl+click should appear by simply clicking;
- The menu should have four items:

Username and Password (that is, what currently happens when I simply click)
Username only
Password only
Cancel

This way I would get rid of having to use the Ctrl key.

Is it possible?
#5
try this

Function KeyUserPassword
Code:
Copy      Help
;/
function $username $password

int action=ShowMenu("1 Username only[]2 Password only[]3 Username and Password[]Cancel")
if(action=0) ret

if(action&1) key (username)
if(action=3) wait 0 ML
if(action&2) key (password)


Toolbar Toolbar1
Code:
Copy      Help
Help :mes "Each menu item enters either username, password or username and password." "" "i" * info.ico
Menu 1 :KeyUserPassword "Username1" "Password1"
Menu 2 :KeyUserPassword "Username2" "Password2"
Menu 3 :KeyUserPassword "Username3" "Password3"
Menu 4 :KeyUserPassword "Username4" "Password4"
#6
That’s great! Thank you.
Previously I had created some attempts, but they did not work.
Your code is perfect.


Forum Jump:


Users browsing this thread: 1 Guest(s)