scanie Posted May 19, 2011 Posted May 19, 2011 (edited) Hi, How can I combine a text string, a variable and then a text string again? I thought I could do it like this: $UserPath = "C:\Users\" & $UserClean[2] & "\GSS" Send($UserPath) But that only returns "C:\Users\<username>". The "\GSS" part is left out. I've also tried to do it like this: $UserPath = "C:\Users\" & $UserClean[2] Send($UserPath & "\GSS") That also only returns "C:\Users\<username>" Help please Edited May 19, 2011 by scanie
wakillon Posted May 19, 2011 Posted May 19, 2011 What do you mean by "combine" ? or show what result you want... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
somdcomputerguy Posted May 19, 2011 Posted May 19, 2011 This outputs C:\Users\cusername\GSS. Post your whole code.Local $UserClean[3] = ["ausername", "busername", "cusername"] $UserPath = "C:\Users\" & $UserClean[2] & "\GSS" ConsoleWrite($UserPath & @LF) - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
somdcomputerguy Posted May 19, 2011 Posted May 19, 2011 Well it's probably got something to do with GSS. This code,Local $UserClean[3] = ["ausername", "busername", "cusername"] $UserPath1 = "C:\Users\" & $UserClean[2] & "\GSS" $UserPath2 = "C:\Users\" & $UserClean[2] & "\ABC" ;ConsoleWrite($UserPath1 & @LF) Send($UserPath1) Send("{ENTER}") Send($UserPath2)'sends' this,C:\Users\cusername\GSSC:\Users\cusername\ABCto SciTE. The GSS is colored red in SciTE, due to the syntax highlighting. I have no idea why though. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
scanie Posted May 19, 2011 Author Posted May 19, 2011 I found the problem I had @CRLF in this section: If IsObj($colItems) then For $objItem In $colItems $UserName = $objItem.UserName & @CRLF Next This is the entire script and it's now working as intended. It resolves logged on user and then inserts correct installation path for a software installation. expandcollapse popup#region ---Au3Recorder generated code Start --- Opt("WinWaitDelay",100) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $UserName = $objItem.UserName Next $UserClean = StringSplit($UserName, "\") ; $UserClean[2] ; Username variable $UserPath = "C:\Users\" & $UserClean[2] ;$UserPath = $UserPath & "\GSS" EndIf _WinWaitActivate("Welcome","") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate("Choose Destination Location","Setup will install G") Send("{ALTDOWN}r{ALTUP}") _WinWaitActivate("Select Destination Directory","") Send($UserPath & "\GSS") Send("{ENTER}") ;_WinWaitActivate("Install","The directory C:\Use", 2) ;Send("{ENTER}") _WinWaitActivate("Choose Destination Location","Setup will install G") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate("Select Program Manager Group","") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate("Start Installation","") Send("{ALTDOWN}n{ALTUP}") #region --- Internal functions Au3Recorder Start --- Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc #endregion --- Internal functions Au3Recorder End --- #endregion --- Au3Recorder generated code End ---
somdcomputerguy Posted May 19, 2011 Posted May 19, 2011 Well I'm glad you got it figured out. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now