Jump to content
Sign in to follow this  
BrokenThumb

Issue w/ MessageBox and @CRLF

Recommended Posts

BrokenThumb

Hey Guys,

So I'm working on another gimmicky script to improve my skills and I cant seem to figure out this issue I'm hitting. Maybe you guys can point out whats going on for me.

This script is basically going to take the input from our users and paste it into the Add Trusted Sites for IE9 and wrap up the adding Trusted Sites process for them. While the below script works (it's not completed but I try to troubleshoot as I go) to the end, it just looks nasty when it adds the variable in.

; Script Start

;VARIABLES
;$newTRUST = User defined URL to be added to IE9's Trusted Sites.

;This segment sets the maching to mode 2 and brings forward the Internet Properties/Security menu.

AutoItSetOption ( "WinTitleMatchMode", 2 )
ShellExecute ( "rundll32.exe", 'shell32.dll,Control_RunDLL inetcpl.cpl,,1' )
WinWaitActive ( "Internet Properties" )

;Now we will access the trusted sites menu.

Send ( "{Right} {RIGHT} {RIGHT}" )
Sleep ( 500 )
Send ( "!s" ) ;Alt + s
WinWaitActive ( "Trusted sites" )
ControlCommand ( "Trusted sites", "Require &server verification (https:) for all sites in this zone", 1023, "UnCheck" )

;This section will display the user input box so they can specify the site they would like added.
$newTRUST = InputBox ( "Website URL to add", "Please enter the URL of the website you would like to add to your Trusted Sites. (ex. www.google.com, www.reddit.com)", "test.test.com", "")
MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites." & $newTRUST )

So I did some digging and it appears that @CRLF is going to allow me to put the $newTRUST data on a new line of the msgbox. However after adding @CRLF it does not display $newTRUST. Any thoughts? Thanks in advance guys.

; Script Start

;VARIABLES
;$newTRUST = User defined URL to be added to IE9's Trusted Sites.

;This segment sets the maching to mode 2 and brings forward the Internet Properties/Security menu.

AutoItSetOption ( "WinTitleMatchMode", 2 )
ShellExecute ( "rundll32.exe", 'shell32.dll,Control_RunDLL inetcpl.cpl,,1' )
WinWaitActive ( "Internet Properties" )

;Now we will access the trusted sites menu.

Send ( "{Right} {RIGHT} {RIGHT}" )
Sleep ( 500 )
Send ( "!s" ) ;Alt + s
WinWaitActive ( "Trusted sites" )
ControlCommand ( "Trusted sites", "Require &server verification (https:) for all sites in this zone", 1023, "UnCheck" )

;This section will display the user input box so they can specify the site they would like added.
$newTRUST = InputBox ( "Website URL to add", "Please enter the URL of the website you would like to add to your Trusted Sites. (ex. www.google.com, www.reddit.com)", "intranet.chq.ei", "")
MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites.", @CRLF & $newTRUST )

Share this post


Link to post
Share on other sites
Mechaflash

MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites.", @CRLF & $newTRUST )

MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites." & @CRLF & $newTRUST )

Replaced the comma with an ampersand before @CRLF.

  • Like 1

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
BrewManNH

This:

MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites.", @CRLF & $newTRUST )

Should be like this:

MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites." & @CRLF & $newTRUST )

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
BrokenThumb

How obnoxious. I tried that before and I kept erroring out...must have been syntax haha.

Thanks Mecha that worked!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×