Posted by Albert Gareev on Mar 09, 2010
Reference page: Active Directory – Sample Scripts (Excel/VBA) Description The function below performs 1-layer deep search of User Account object in all Organizational Units contained under parent Organizational Unit. The function can be easily modified for a recursive search if children OU hierarchy is unknown. Use objUser.Get(“distinguishedName”) to retrieve full LDAP path of found […] ...
Posted by Albert Gareev on Mar 01, 2010
Reference page: Active Directory – Sample Scripts (Excel/VBA) How to modify Attributes of an Object Introduction In Microsoft Active Directory Object Classes have Attributes representing additional information about an object. It could be Firstname, Lastname – for a person, Address and Phone number both for a person and organization. Access to Attributes is performed through LDAP calls, […] ...
Posted by Albert Gareev on Feb 25, 2010
Parent page: Service Functions – String (QTP, VBScript) Question The question was asked here. Hi Albert! Can you email me a QTP function that wraps line of text without breaking words? Thank you! Answer Proper text alignment is important. The whole layout of CSS block or HTML table could be broken if a text line […] ...
Posted by Albert Gareev on Feb 22, 2010
Parent page: Service Functions – String (QTP, VBScript) Question The question was asked here. What QTP function i can use to trim inside string? For e.g. “text text text text” – i want only 1 space between. Answer I believe the sample string provided in the question originally contained multiple space characters inside but was […] ...
Posted by Albert Gareev on Feb 18, 2010
Reference page: Active Directory – Sample Scripts (Excel/VBA) How to create Security Group Description Security Group object could be created within its container object – Organizational Unit. The example below is based on the assumption that we successfully retrieved an instance of Organizational Unit. An existing User Account will also be added to the newly […] ...
Posted by Albert Gareev on Feb 16, 2010
Reference page: Active Directory – Sample Scripts (Excel/VBA) How to create User Account Description User Account object could be created within its container object – Organizational Unit. The example below is based on the assumption that we successfully retrieved an instance of Organizational Unit. Note. You need to login as an authorized person to successfully execute […] ...
Posted by Albert Gareev on Feb 14, 2010
Basic Active Directory Queries How to retrieve Organizational Unit How to retrieve User Account How to retrieve Security Group Working with Active Directory Objects How to create User Account How to create Security Group How to modify Attributes of an Object Advanced Active Directory Queries Processing Security Group Membership for User Account Search for User […] ...
Posted by Albert Gareev on Feb 12, 2010
Reference page: Active Directory – Sample Scripts (Excel/VBA) How to retrieve Security Group Description Build LDAP Query – Execute Query – Catch Errors Note. You need to login as an authorized person to successfully execute the script. Common definitions How to retrieve Active Directory Security Group (Excel/VBA source code) Note that Security Group is an object […] ...
Posted by Albert Gareev on Feb 11, 2010
Reference page: Active Directory – Sample Scripts (Excel/VBA) How to retrieve User Account Description Build LDAP Query – Execute Query – Catch Errors Note. You need to login as an authorized person to successfully execute the script. Common definitions How to retrieve Active Directory User Account (Excel/VBA source code) Note that we enlist directory tree nodes […] ...
Posted by Albert Gareev on Feb 10, 2010
Reference page: Active Directory – Sample Scripts (Excel/VBA) How to retrieve Organizational Unit Description Build LDAP Query – Execute Query – Catch Errors Note. You need to login as an authorized person to successfully execute the script. Common definitions How to retrieve Organizational Unit (Excel/VBA source code) Note that we enlist directory tree nodes backwars when […] ...
Posted by Albert Gareev on Jan 29, 2010
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Open worksheet – Loop through data range – close and save the workbook. Note. In the example below script finds empty cells and assigns zero to them. Make sure you targeted the worksheet that you need. You can find it […] ...
Posted by Albert Gareev on Jan 27, 2010
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Loop through worksheets – close and save the workbook. 1. If you know Excel Worksheet name and pretty sure it exists 2. If you don’t know Excel Worksheet name exactly or not sure if it exists ...
Posted by Albert Gareev on Jan 24, 2010
Parent page: Service Functions – System (QTP, VBScript) Use FileSystemObject.FolderExists method. Argument should be a full path string. When to use it? Always before trying to access the folder (delete, rename, or read from) or create files in it. Note. Always release the object you created when you no longer need it. If you don’t do […] ...
Posted by Albert Gareev on Jan 21, 2010
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Retrieve Code Module object – Add new macro string – close and save the workbook. Notes. For this example let’s assume our target Workbook is stored as “C:\Temp\1.xls”, and our target Code Module is named “Module1”. QTP/VBScript source code ...
Posted by Albert Gareev on Jan 20, 2010
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Retrieve Code Module object – Retrieve Code Block string – Parse the string – close and save the workbook. Notes. For this example let’s assume our target Workbook is stored as “C:\Temp\1.xls”, and our target Code Module is named “Module1”, and ...
Posted by Albert Gareev on Jan 15, 2010
Parent page: Service Functions – Excel (QTP, VBScript) Answers 1. To pass-in parameters to an Excel VBA function A function must be public and belong to a Macro Module. QTP/VBScript source code Excel/VBA function source code 2. To retrieve parameters from an Excel VBA function You need to reserve cells on a worksheet for that purpose. […] ...
Posted by Albert Gareev on Jan 14, 2010
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Invoke the function – Catch error – close and save the workbook. Notes. Macro (Sub or Function) must be public and belong to a Macro Module. ...
Posted by Albert Gareev on Jan 12, 2010
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from. In my blog I maintain the similar structure. Functions Excel File Worksheet compare (QTP, VBScript) How to check if Excel Workbook is locked A little automation for VBScript OOP (1) A little automation for […] ...
Posted by Albert Gareev on Dec 30, 2009
Parent page: Service Functions – XML (QTP, VBScript) Answers Description Open XML file – load into memory – locate target nodes – update (replace) values – save XML file (either under a new name or overwrite the original file). Search is performed by tag name (“target_node”). If you pass in a non-string parameter for .SetValue function, convert […] ...
Posted by Albert Gareev on Dec 29, 2009
Parent page: Service Functions – XML (QTP, VBScript) Answers 1. How to count all direct children? 2. How to count all direct children, specific name tag? 3. How to count all descendants? References Read more about XPath queries. ...
Posted by Albert Gareev on Dec 23, 2009
All related posts: Reference Page – GP/QTP Automation Dexterity Macro Limitation and Suggested Workaround One of the major limitations identified in Dexterity Macro System is totally hard-coded data with no functionalities to read them from any external source. To overcome this issue we can dynamically generate Dexterity macro text file from a pre-built XML template. After the file […] ...
Posted by Albert Gareev on Dec 21, 2009
All related posts: Reference Page – GP/QTP Automation Answer According to the documentation, there are no loop operators defined in Microsoft Dynamics Great Plains Dexterity Macros. However, the macro language provides other commands to workaround the issues in the most required cases. Workarounds 1. Capture values of GUI fields (in a loop) Use DumpFieldBegin…DumpFieldEnd commands. 2. Window synchronization […] ...
Posted by Albert Gareev on Dec 16, 2009
Parent page: Service Functions – System (QTP, VBScript) How to create a unique subfolder Description A subfolder is created based on the name pattern and a date-time stamp, e.g. “AccountSearch 2009-10-14 17-18-03”. You can add extra steps and form the code as a function that returns full path of the newly created subfolder. sName – name pattern sFullPath […] ...
Posted by Albert Gareev on Dec 15, 2009
Parent page: Service Functions – System (QTP, VBScript) How to duplicate an existing file (If you want to access the file but it’s locked) Description sFileName – name of the file to duplicate sNewName – name of created file (generated automatically), pass-back argument. Uses UniqueFilename function to generate a name for the duplicate file. ...
Posted by Albert Gareev on Dec 14, 2009
Parent page: Service Functions – System (QTP, VBScript) How to generate a unique file name if the file name already exists in the given folder (That often happens, if you need to create a series of files or duplicate an existing file) Description sFileName – the “original” file name or file name template sFolderName – parent folder […] ...
Posted by Albert Gareev on Dec 09, 2009
Parent page: Service Functions – System (QTP, VBScript) Description If you need to generate text file with values you don’t know ahead you may do it dynamically, by utilizing the function below. Make sure you designed template first. The current logic is oriented to executable text files generation, like Dexterity Macro or OS Shell batch files. Code lines are data-driven, […] ...
Posted by Albert Gareev on Dec 07, 2009
All related posts: Reference Page – GP/QTP Automation Dexterity Macro Limitation One of the major limitations identified in Dexterity Macro System is totally hard-coded data with no functionalities to read them from any external source. Running scripts that always look for exactly the same account number or check balance on always the same date would provide a little […] ...
Posted by Albert Gareev on Dec 05, 2009
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from. In my blog I maintain the similar structure. FileSystemObject (FSO) FileSystemObject is a primary “interface object” for the all standard Drive/File/Folder operations: retrieving information (Drive), creating/renaming/deleting and getting/setting properties/attributes (Folders and Files), reading/writing ...
Posted by Albert Gareev on Dec 03, 2009
Root page: Service Functions – XML (QTP, VBScript) Parent page: XSL introduction and references Related post: Text File compare in “WDIFF” style (QTP, VBScript, XML, XSL) – Instructions and XSL script Sample task After line by line (and word by word) text file comparison has been performed, XML log was produced. Review the log, identify and report found issues. […] ...
Posted by Albert Gareev on Dec 02, 2009
Root page: Service Functions – XML (QTP, VBScript) Parent page: XSL introduction and references Sample task Verify “transactions” xml file consisting of 10-1000 records. Only “debit” or “credit” record names are valid. Any other entries must be located and reported. Additionally, identify and report all debit records with debit amount greater than 50.00 Sample XML As you can […] ...