Integrating a Login Macro |
Top Previous Next |
Let's suppose you need to authenticate a user into a connection host. To do that you need a macro that positions the cursor in the username and password fields and enters the right credentials. Let's suppose our username is "peter" and his password is "peterPass". You can send these values in the z/Scope Anywhere URL query string by adding them like this:
The _asuser and _aspass values will be available inside the z/Scope Anywhere macros. That way you can use them to authenticate against the connection host. Follow the next steps to learn how to use these values to perform the host authentication:
1. Record the macro:
You can start by recording a macro that performs the host login. Find out on the Programming Reference for Macros how to edit the macro after you've created it. You will see that the macro code will look like this:
2. Modify the macro to work with all users:
You know that this macro is now running for the user "peter" only, but you need it to be generalized for all users. The way to modify this macro to use the variables "_asuser" and "_aspass" is by replacing the methods type and setField, as follows:
The "v" methods will use the query string variable values. You can check further documentation regarding the typeV and setFieldV methods. The updated macro should look like this:
3. Take the macro to the public directory
All the macros are created by default on the user directory. In order to make the macro available to all users, you have to move it from the user directory to one directory level above. Copy the login macro you have just created:
from C:\ProgramData\Cybele Software\zScope7\[UserName] to C:\ProgramData\Cybele Software\zScope7\
4. Configure the connection to auto start the macro:
If you want the connection to automatically perform the authentication every time it is started, you should set this macro to be autostarted on the Connection Preferences tab.
Read more:
|