Jump to content

How to combine text and variables in new variable or msgbox output?


Recommended Posts

Here's what I have tried. The intended output is in a comment. I'm trying to create a source directory path using multiple variables and text. Thanks for any help.

#include <GUIConstants.au3>

#forcedef $system_environment

#forcedef $major_release

#forcedef $minor_release

call("major_release")

call("minor_release")

call("system_environment")

call("displaysourcepath")

Func major_release()

$major_release = InputBox("Enter the Major (.0) release #", "Enter the major release #")

Sleep(500)

MsgBox(4, "Is this the correct Major (.0) release #?", $major_release)

EndFunc ;==>major_release

Func minor_release()

$minor_release = InputBox("Enter the Minor release #", "Enter the minor release #")

Sleep(500)

MsgBox(4, "Is this the correct Minor release #?", $minor_release)

EndFunc ;==>minor_release

Func system_environment()

$system_environment = InputBox("Enter the system_environment", "Enter the system_environment")

Sleep(500)

MsgBox(4, "Is this the correct system_environment?", $system_environment)

EndFunc ;==>system_environment

Func displaysourcepath()

$sourcepath = string("\\srv100\Source\Installation\" & $major_release & "\" & $minor_release & "." & $system_environment)

msgbox(4, "Is this the correct Source directory PATH?", $sourcepath)

;supposed to come out \\srv100\source\installation\12.1.5.0\12.1.5.6.uat

EndFunc

Link to comment
Share on other sites

There are several things wrong in that script, first is, don't use ForceDef because it's not declaring the variables as you think they are. Second, there's no reason to use Call for this script. Third, you have a msgbox displaying the input, but you don't ever do anything with the result from them, whether they choose yes or no, the script continues.

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

Link to comment
Share on other sites

RonPaul,

When you post code please use code tags

[/autoit][/b]

Building on what BrewmanNH has pointed out, consider the following code:

[autoit]

#include <Constants.au3>
#include <GUIConstants.au3>

local $major_release, $minor_release, $system_environment, $sourcepath

while $major_release = ""
    $major_release = InputBox("Enter the Major (.0) release #", "Enter the major release #")
wend

while $minor_release = ""
    $minor_release = InputBox("Enter the Minor release #", "Enter the minor release #")
WEnd

while $system_environment = ""
    $system_environment = InputBox("Enter the system_environment", "Enter the system_environment")
WEnd

local $sourcepath = string("\\srv100\Source\Installation\" & $major_release & "\" & $minor_release & "." & $system_environment)

msgbox($mb_ok,'My Source Path',$sourcepath & @LF)

The help file is your best resource. Also, if you are not using the full SCITE editor you should downoad and install it before too long.

Good Luck,

kylomas

edit: trying to fix how to display code tags, damn alzhiemers!

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...