Value not picked up by RunWait %comspec% Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
koenboots
Posts: 22
Joined: 17 Aug 2016, 03:13

Value not picked up by RunWait %comspec%

17 Jan 2018, 07:42

Hi all,

Let me start by explaining I'm a n00b, using the trial&error method and consulting help files only when needed for developing a working solution instead of studying the basics much.

I'm struggling with a RunWait command utilizing the Windows command prompt, for which I found valuable information on this very forum. I've tested the functionality to be working, but when introducing the value of an edit field of my GUI to the code, it's not working.
The entire solution has grown quite a bit over time so I won't share the entire code, but here are the fundamentals:

Code: Select all

Gui, Add, Edit, x70 y370 w75 h20 BackgroundTrans +Uppercase vComputer, 
Gui, Add, Button, x145 y370 w20 h20 -TabStop gButtonRA, &r
Gui, Add, Button, x165 y370 w10 h20 -TabStop gCopyClipComputer, &c
Gui, Show, w365 h500, SDLogTool

GuiClose:
ExitApp

CopyClipComputer:
Gui, Submit, NoHide
clipboard = % Computer
TrayTip, SDLogTool, Computernummer gekopieerd naar klembord, 2, 1
Return

ButtonRA:
RunWait, %comspec% /c msra /offerra %Computer%
Return
Button CopyClipComputer is working fine
Button ButtonRA currently results in Windows Remote Assistant launching, but without the Computer-value or maybe a false one (I can't track the result).
The entered value is always something like LT-12345. When I hardcode a value (i.e. RunWait, %comspec% /c msra /offerra LT-12345) it's working fine, but not using variable %Computer%.
I can't figure out what I'm doing wrong and would very much appreciate it if someone can point it out to me.

Thanks a lot
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Value not picked up by RunWait %comspec%  Topic is solved

17 Jan 2018, 07:49

Code: Select all

Gui, Add, Edit, x70 y370 w75 h20 BackgroundTrans +Uppercase vComputer, 
Gui, Add, Button, x145 y370 w20 h20 -TabStop gButtonRA, &r
Gui, Add, Button, x165 y370 w10 h20 -TabStop gCopyClipComputer, &c
Gui, Show, w365 h500, SDLogTool
Return

GuiClose:
   ExitApp

CopyClipComputer:
   Gui, Submit, NoHide
   clipboard := Computer   ; expression-style. Check out the AHK help for details > "Variables"
   TrayTip, SDLogTool, Computernummer gekopieerd naar klembord, 2, 1
   Return

ButtonRA:
   Gui, Submit, NoHide   ; was missing. Alternative > "GuiControlGet"
   MsgBox % "Computer: " . Computer . "`nClipBoard: " . ClipBoard   ; let's have a look! 
   RunWait, %comspec% /c msra /offerra %Computer%   ; should work that way
;  RunWait, % comspec . " /c msra /offerra " . Computer   ; expression-style
   Return
Not tested.
Guest

Re: Value not picked up by RunWait %comspec%

17 Jan 2018, 09:12

BoBo wrote:Not tested.
Thanks BoBo! Forgetting line Gui, Submit, NoHide was the dealbreaker, this fixed it! Thanks also for the other remarks.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Archimede, Chunjee, Google [Bot], Ruediger Loos and 328 guests