ardy8888
(Fresh Scripter)
2016-03-29 11:03 PM
Inputbox is appearing minimized

I've got kixtart working to open an inputbox to request the user to enter some info. However, the inputbox is appearing minimized, right next to the minimized kixtart application window. Any idea why the inputbox is minimized and how I can have it not minimized by default.

Glenn BarnasAdministrator
(KiX Supporter)
2016-03-30 01:07 AM
Re: Inputbox is appearing minimized

InputBox? Are you using Kixforms?

Post a bit of the code so we can help you figure it out!

Glenn


ardy8888
(Fresh Scripter)
2016-03-30 02:19 PM
Re: Inputbox is appearing minimized

I honestly don't know if this is Kixforms. Here is the code I am running. Basically, checks for group membership. If the user is in the group, an inputbox is supposed to pop up asking for their email address and then the script sends an email to that address. Everything works except that the inputbox shows up minimized.
 Code:
 if ingroup ("adsstest")
	SHELL 'cscript //nologo \\domain.local\netlogon\ADSelfService_Enroll_Check.vbs'
	if @ERROR = 47
		$smtpto=inputbox("Enter your email address for more info on Enrollment.","Enrollment")
		MAILER($smtpto)
	endif
endif



AllenAdministrator
(KiX Supporter)
2016-03-30 03:21 PM
Re: Inputbox is appearing minimized

Probably using this... http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=197076#Post197076

BradV
(Seasoned Scripter)
2016-03-30 03:27 PM
Re: Inputbox is appearing minimized

I would suggest using the built-in messagebox function. Also, kixtart is quite good at figuring out group membership. If you tell us what is in ADSelfService_Enroll_Check.vbs someone here can probably tell you how to do that without visual basic.

Glenn BarnasAdministrator
(KiX Supporter)
2016-03-30 03:51 PM
Re: Inputbox is appearing minimized

Brad - MessageBox is output only (OK, mostly - it allows button-based input). This needs to prompt for manual input text - email address. Also - he is using Kix for membership identification (If InGroup). \:\) I do agree that we can probably replace the VBS, but suspect its a 3rd party component of the AD Self Service app.

I looked at that function and don't see any controls for presence (minimize, show/hide, etc.) I did a quick look at this but could not find any more information about control options. I'd suggest not minimizing the Kix script and see if that helps.

KixForms would certainly help here, but that would require deploying/registering the DLL. Not as big an issue as you might suspect. I've used a BAT file to copy Kixforms.dll to C:\TEMP, register it with RegSvr32, then invoked the Kix/KF app, and then unregistered/delete the DLL. Hardly took any time at all. User permissions could be an issue with this, however, as users rarely have the needed rights nowadays.

Glenn


ardy8888
(Fresh Scripter)
2016-03-30 04:03 PM
Re: Inputbox is appearing minimized

Hey Brad, thanks for the response here!

Can the messagebox function take input?? I assumed it was just to post a message which is why I went with inputbox. The vbs script makes an http post to query if someone has enrolled into a selfservice portal (ManageEngine's ADSelfServicePlus). The post is made to the selfservice application directly and it returns true or false. Below is the vbs code. I've copied this section from a script provided by ManageEngine as their script did some other tasks I didn't need. I could probably simplify the script a bit as it is querying for the domain name but that is the same for everyone so I could specifically state that in the http post

 Code:
On Error Resume Next
	Set objNetwork = CreateObject("WScript.Network")
	
	url = "https://localhost:443" + "/CheckEnrollment.cc"
	postData = "user=" + objNetwork.UserName + "&domainFlatName=domain" + "&domainDNSName=domain.local" + "&manualScript=true"
	
	Set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")	
       	oHTTP.open "POST", url,false 
      	oHTTP.setOption 2, 13056
        oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        oHTTP.setRequestHeader "Content-Length", Len(postData)
        oHTTP.send postData  
	response = oHTTP.responseText
	result = 0
	   	If InStr(response, "Non-Enrolled User") Then
			result = 12
			ElseIf InStr(response, "Enrolled User") Then	
			result = 47
		End If
	wscript.quit result
	


ardy8888
(Fresh Scripter)
2016-03-30 04:12 PM
Re: Inputbox is appearing minimized

Thanks for the all the responses here. When I run kix32 manually which doesn't minimize, the inputbox is not minimized. It only seems to be minimized at logon, when kixtart is minimized.

Glenn BarnasAdministrator
(KiX Supporter)
2016-03-30 04:30 PM
Re: Inputbox is appearing minimized

You can control Kix being visible with the SetConsole() function - try the Show, AlwaysOn Top, Foreground, and Maximize parameters to see which one works best for your situation.

I kind of figured that the InputBox state would follow the Kix script state.

Glenn

PS - use CODE tags around your code - click Edit on one of your prior posts to see exactly how.. \:\) Makes it easier to see the indents and logic flow.


ardy8888
(Fresh Scripter)
2016-03-30 05:03 PM
Re: Inputbox is appearing minimized

Thanks Glenn, will this SetConsole() function make the entire kixtart script visible or can I set this just for the inputbox? Just trying to understand where SetConsole() should be in the file.

ardy8888
(Fresh Scripter)
2016-03-30 05:55 PM
Re: Inputbox is appearing minimized

Awesome! I just played with SetConsole and if I select HIDE, the kix32 script window is hidden but the inputbox does appear, not minimized or hidden!!

Thanks for everyone's input here!


Glenn BarnasAdministrator
(KiX Supporter)
2016-03-30 07:50 PM
Re: Inputbox is appearing minimized

Playing is good!

The SetConsole applies to the Kix script, but likely has side effects on the VBS code that produce the desired results.

Glad it worked out.

Glenn