Cmdlet Autocomplete & "In" autocomplete

Support for all customers who have purchased a PrimalScript product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
User avatar
clum09
Posts: 120
Joined: Thu Apr 24, 2008 9:11 am

Cmdlet Autocomplete & "In" autocomplete

Post by clum09 » Mon Dec 04, 2017 1:43 pm

Product, version and build: 7.3.108
32 or 64 bit version of product: 64-Bit
Operating system: Windows 10
32 or 64 bit OS: 64-Bit

Hello,

I have been unable to to have PrimalScript's PrimalSense to autocomplete the Azure Active Directory cmdlets in the Editor like it does on the PowerShell ISE.
Is there anyway I can have PrimalSense autocomplete the Azure Active Directory cmdlets?

Some of the cmdlets used for Azure Active Directory is Connect-MsolService, Set-MsolUserLicense, etc.

One annoying thing I found in PrimalScript editor is any time I try to write a for...loop command in the Editor, it tries to upper case the "i" letter of the word in to "I", such as in foreach ($i in $list) {$i}. Instead if leaving the "in" keyword as it is, it tries to upper case the "i" of the word "in" to "In" instead.

Is there any way to remove the autocomplete of the keyword "in" so that the "i" letter stays as I type it without upper casing the letter "I"?

User avatar
mxtrinidad
Site Admin
Posts: 45
Joined: Sun Mar 03, 2013 12:42 pm

Re: Cmdlet Autocomplete & "In" autocomplete

Post by mxtrinidad » Mon Dec 04, 2017 2:07 pm

In PrimalScript, look under "File" menu, click on "Options" then under "Text Editor" in "PrimalSense | PrimalSense Option" unchecked the "Auto case correction". This should stop the behavior you're experiencing.

User avatar
Alexander Riedel
Posts: 6361
Joined: Tue May 29, 2007 4:43 pm

Re: Cmdlet Autocomplete & "In" autocomplete

Post by Alexander Riedel » Mon Dec 04, 2017 4:07 pm

Bring up the cache editor in the ribbon and make sure your Azure module is selected for the platform and powershell version you are using.
Please also make sure that you have that same platform and PowerShell version selected in PrimalScript's ribbon.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 120
Joined: Thu Apr 24, 2008 9:11 am

Re: Cmdlet Autocomplete & "In" autocomplete

Post by clum09 » Tue Dec 05, 2017 7:56 am

When I unchecked the "Auto case correction" in "Text Editor" in "PrimalSense | PrimalSense Option" dialog, it stopped the auto casing for the "in" keyword, and it also stopped to autocomplete and auto case for the functions that I had within the script.

For the Autosense of the Azure modules, I added all the Azure modules for the proper platform and PowerShell version in cache editor and clicked on "Build Cache" button, but the autosense still does not work even after restarting PrimalScript.

User avatar
mxtrinidad
Site Admin
Posts: 45
Joined: Sun Mar 03, 2013 12:42 pm

Re: Cmdlet Autocomplete & "In" autocomplete

Post by mxtrinidad » Tue Dec 05, 2017 8:17 am

Thanks for responding.

We are taking a look at it and we'll get back to you soon.

User avatar
Alexander Riedel
Posts: 6361
Joined: Tue May 29, 2007 4:43 pm

Re: Cmdlet Autocomplete & "In" autocomplete

Post by Alexander Riedel » Tue Dec 05, 2017 9:27 am

What version of the Azure module do you have installed?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 6361
Joined: Tue May 29, 2007 4:43 pm

Re: Cmdlet Autocomplete & "In" autocomplete

Post by Alexander Riedel » Tue Dec 05, 2017 9:32 am

I fired up PrimalScript with default settings and typed foreach ($i in $list) {$i} in a PowerShell Script.
The 'in' did not case correct to 'In'
Do you have a variable called '$In' in your script or a function 'In' or a '-In' parameter?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 120
Joined: Thu Apr 24, 2008 9:11 am

Re: Cmdlet Autocomplete & "In" autocomplete

Post by clum09 » Tue Dec 05, 2017 10:33 am

The Azure for Active Directory version is 1.1.166.0.

For the in casing, you can try copy the following for loop script onto a blank page of the PrimalScript's Editor.

As soon as you change In to in on the first line, PrimalScript will upper case the i in front of in to In.

Code: Select all

foreach ($objUser In $unlicensedUserList)
{
	if ($groupUserList.ContainsKey($objUser.UserPrincipalName))
	{
		$userPrincipalName = $objUser.UserPrincipalName;
		$displayName = $groupUserList.Item($userPrincipalName);
		$msg = "Activating license for $displayName. . .";
		try {
			Set-MsolUserLicense -UserPrincipalName $userPrincipalName -AddLicenses "domain:ENTERPRISEPACK";
			$msg = "Activation completed successfully.";
			$object = '' | Select-Object 'User Name','Activated',Message;
			$object.'User Name' = $displayName;
			$object.'Activated' = $true;
			$object.Message = $msg;
			$activatedUserList += $object;
		}
		catch
		{
			$msg = $_.Exception.Message;
			$object = '' | Select-Object 'User Name','Activated',Message;
			$object.'User Name' = $displayName;
			$object.'Activated' = $false;
			$object.Message = $msg;
			$unActivatedUserList += $object;
		}
	}
}

User avatar
Alexander Riedel
Posts: 6361
Joined: Tue May 29, 2007 4:43 pm

Re: Cmdlet Autocomplete & "In" autocomplete

Post by Alexander Riedel » Tue Dec 05, 2017 10:39 am

This is a mix of two issues here, which makes this a little bit cumbersome. In the future please create a thread for one issue.
I will investigate both and see what I can find out.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 6361
Joined: Tue May 29, 2007 4:43 pm

Re: Cmdlet Autocomplete & "In" autocomplete

Post by Alexander Riedel » Tue Dec 05, 2017 10:42 am

I paste your code in a new windows and correct to 'In' to 'in'
2017-12-05_9-41-09.png
2017-12-05_9-41-09.png (129.39 KiB) Viewed 579 times
I do not see any case correction.
Alexander Riedel
SAPIEN Technologies, Inc.