Jump to content

How to run a variable


Recommended Posts

Can someone help me run $sCmd instead of:

$sCmd = Run('e:\backups\imagex_gui\imagex.exe /info e:\backups\test2.wim ', '', @SW_HIDE, 2)

$sCmd is the equivalent of:

e:\backups\imagex_gui\imagex.exe /info e:\backups\test2.wim

I've looked but am so new to programing that nothing makes sense

Thanks

Func DoInfo()

#Region ### START Koda GUI section ### Form=

$InfoGUI = GUICreate("InfoGUI", 666, 444, 300, 222)

$Edit10 = GUICtrlCreateEdit("", 40, 56, 600, 300)

$Gobtn = GUICtrlCreateButton("go", 200, 410, 81, 25, 0)

$exitbtn = GUICtrlCreateButton("exit", 300, 410, 81, 25, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

;================================================================================

; inserted

$gInfoSource = GUICtrlRead($hInfoSourceEdit)

$gInfoDescription = GUICtrlRead($hInfoDescEdit)

$gInfoFlags = GUICtrlRead($hInfoFlagsEdit)

$gInfoBoot = GUICtrlRead($hInfoBootCheck)

$gInfoCheck = GUICtrlRead($hInfoCheckCheck)

$gInfoName = GUICtrlRead($hInfoNameEdit)

$gInfoNumber = GUICtrlRead($hInfoNumber)

;================================================================================

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $exitbtn, $GUI_EVENT_CLOSE

GUIDelete ($InfoGUI)

exitloop

Case $Gobtn

Do

;================================================================================

; inserted

$sCmd = '"' & @ScriptDir & '\imagex.exe"'

If $gInfoCheck = 1 Then $sCmd = $sCmd & " /check"

If $gInfoBoot = 1 Then $sCmd = $sCmd & " /boot"

If $gInfoFlags <> "" Then $sCmd = $sCmd & ' /flags "' & $gInfoFlags & '"'

$sCmd = $sCmd & ' /Info "' & $gInfoSource & '"'

SplashTextOn("command", $sCmd, 1300, 200, -1, -1, 32, "Tahoma", 16, 500)

Sleep(2000)

SplashOff()

;====================================================================================

Local $sCmd, $data

$sCmd = Run('e:\backups\imagex_gui\imagex.exe /info e:\backups\test2.wim ', '', @SW_HIDE, 2)

Do

$data &= StdoutRead($sCmd)

Until @error

ProcessWaitClose($sCmd)

GUICtrlSetData($Edit10, $data, 1)

until $exitbtn

EndSwitch

wend

Endfunc ;===DoInfo

Link to comment
Share on other sites

Perhaps with this?

$sCmd = '"' & @ScriptDir & '\imagex.exe"'
If $gInfoCheck = 1 Then $sCmd = $sCmd & " /check"
If $gInfoBoot = 1 Then $sCmd = $sCmd & " /boot"
If $gInfoFlags <> "" Then $sCmd = $sCmd & ' /flags "' & $gInfoFlags & '"'
$sCmd = $sCmd & ' /Info "' & $gInfoSource & '"'
ConsoleWrite("Debug: $sCmd = " & $sCmd & @LF)

$PID = Run($sCmd, '', @SW_HIDE, 2)

Do
    $data &= StdoutRead($PID)
Until @error
ProcessWaitClose($PID)
GUICtrlSetData($Edit10, $data, 1)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

you should remember that in a variable you can put only 1 certain datatype at a time ..

if it's a string(the actual command), you can't insert a function (run) on top.

if you want a variable to contain an object (when you use set) and you insert anything else than an object, your interpreter will error on that too..

Link to comment
Share on other sites

Thanks to all that helped me.

I assume everyone knows I was modifying ImageX_Wrapper. I have found this way I can learn and modify a program to suit me at the same time. I think it will be a long while before I get at all effeciant as a programmer

Thanks again for the help

If anyone wants the modifyed version I would be glad to post it.

I do have one question. I will use this on PEBuilder but I found that I could not do a mount. It works from XP but not from PEBuilder. It really doesn't need to but I like everything to work

I'm sure some of you can identify with this (:

Just had another error: Fatal Error box Avector: Out of bounds This has happened on several tabs

I am using version 3.2.5.2 beta

never had this with old version

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