Jump to content

Taking Text from List and Adding Data part of command line


Recommended Posts

So i have spent the past hour or so looking at threads and can't really seem to understand. I want to be able to select a window size from left list and then from that selection.

I tried using GuiCtrlRead($list1) but that doesnt seem to do it. If I were to choose 480, instead of running the program with @ comes back with "GuiCtrlRead($list1)".

Posted Image

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <GUIListBox.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <Process.au3>

Opt("GUIOnEventMode", 1)

Opt("TrayIconDebug", 1)

$Form2 = GUICreate("Form2", 359, 187, 229, 546)

Global $Button1 = GUICtrlCreateButton("South Windsor V: Map", 16, 32, 161, 57, $WS_GROUP)

Global $Button2 = GUICtrlCreateButton("Cromwell V: Map", 184, 32, 161, 57)

$List1 = GUICtrlCreateList("", 22, 120, 81, 58)

GUICtrlSetData(-1, "|480|640|768")

Global $Button3 = GUICtrlCreateButton("Launch", 112, 120, 225, 57)

GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman")

$Label1 = GUICtrlCreateLabel("Select Window Size and click Launch to start Visual", 24, 96, 297, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Arial Black")

$Label2 = GUICtrlCreateLabel("Click on Button to change Drive mapping of V:\", 40, 8, 284, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Arial Black")

GUICtrlSetOnEvent($button1, "gui0")

GUICtrlSetOnEvent($button2, "gui1")

GUICtrlSetOnEvent($button3, "gui2")

GUISetOnEvent($GUI_EVENT_CLOSE, "_Close")

GUISetState(@SW_SHOW)

While 1

Sleep(200)

WEnd

Func gui0()

Global $gui0 = _RunDos("net use v: /delete /yes")

_RunDos("net use v: \\sw-db\ve654")

_RunDos("net use v: /delete /yes")

_RunDos("net use v: \\sw-db\ve654")

EndFunc

Func gui1()

Global $gui1 = _RunDos("net use v: /delete /yes")

_RunDos("net use v: \\cw-db\visual654")

_RunDos("net use v: /delete /yes")

_RunDos("net use v: \\cw-db\visual654")

EndFunc

Func gui2()

Global $gui2 = run("v:\vm.exe -w GuiCtrlRead($list1)",)

EndFunc

Func _Close()

GUIDelete()

Exit

EndFunc

Link to comment
Share on other sites

Take this line: Global $gui2 = Run("v:vm.exe -w GuiCtrlRead($list1)",) and change it to this Global $gui2 = Run("v:vm.exe -w " & GuiCtrlRead($list1)) and see if that works for you.

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

ah dang, that worked. haha. Thank you so much. I was litterly looking at the threads for so long trying to figure it out. I think i got pretty close haha.

Could you also point me to resource on the GuiCtrlRead? I want to do a little more. Like for example a list that says "full screen, windowed, minized" so example of out put would be like "v:VM.exe -w 650 -s full"

So what I tried to do is make another list and type up

Global $gui2 = Run("v:vm.exe -w " & GuiCtrlRead($list1) & GuiCtrlRead($list2))

EDIT: I figured it out :-D so happy hehe. I also figured out I need to add a space in the for the -s part or else it would combine with the previous text.

Global $gui2 = Run("v:vm.exe -w " & GuiCtrlRead($list1) & " -s" & GuiCtrlRead($list2))

Edited by Longvl85
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...