Jump to content

Script help


Gtek
 Share

Go to solution Solved by Gtek,

Recommended Posts

Hi

thanks in advance :D

Can one of you hardcore guys see way may script go's wrong.

it's my $input i can't get to continue and insert it in the Run line.

I have use the line $rc=_rundos 3 years ago and it worked whit the $input line, but alot have change :huh2:.

i'm no big programer so i tryed this.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $ExitID, $input

_Main()

Func _Main()
    Local $imagesID, $installID

    GUICreate("Fineman Imaging", 310, 80)

    GUICtrlCreateLabel("Please select a action!", 10, 10)
    $ImagesID = GUICtrlCreateButton("Images", 10, 50, 50, 20)
    GUICtrlSetOnEvent($imagesID, "OnYes")
    $installID = GUICtrlCreateButton("Install", 80, 50, 50, 20)
    GUICtrlSetOnEvent($installID, "OnNo")
    $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
    GUICtrlSetOnEvent($ExitID, "OnExit")

    GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")

    GUISetState()  ; display the GUI

    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main

;--------------- Functions ---------------
Func OnYes()
DriveMapAdd("y:", "\\10.0.1.17\public\teknik_images\ibase", 0)
    Local $iLoop = 1
             While $iLoop = 1
                     $input = InputBox("Image name", "Enter path and file name")
                        If @error = 1 Then
                           MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
                        Else
                           if $input = FileExists("y:\'& $input'.gho") Then
    Else
         $iLoop = 0
    EndIf
EndIf
WEnd

Run(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=restore,src=\\10.0.1.17\public\teknik_images\ibase\'& $input'.gho,dst=1 -sure -auto',"")
If @error = 0 Then
                           MsgBox(4096, "Error", "error")
EndIf
drivemapdel ("Y:")
EndFunc   ;==>OnYes to image

Func OnNo()
    DriveMapAdd("y:", "\\10.0.1.17\public\teknik_images\ibase", 0)
     $input = InputBox("Image install name", "Enter file name")
        If @error = 1 Then
            MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
EndIf
Run(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=create,src=1,dst=\\10.0.1.17\public\teknik_images\ibase\'& $input' -sure -auto',"")
If @error = 0 Then
                           MsgBox(4096, "Error", "error")
EndIf
drivemapdel ("Y:")
EndFunc   ;==>OnNo

Func OnExit()
    If @GUI_CtrlId = $ExitID Then
        MsgBox(64, "Exit", "Imaging Canceled")
    Else
        MsgBox(64, "Cancel", "Action Canceled")
    EndIf

    Exit
EndFunc   ;==>OnExit
Link to comment
Share on other sites

  • Moderators

Just at a glance, I can see errors on lines 48 and 61. Your @ComSpec call is missing an & after $input. If you have the full version of AutoIt installed along with SciTE, you should really use CTRL+F5 to check syntax. 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Gtek,

Welcome to the AutoIt forum. :)

In future could you please give more descriptive titles to your threads - needing help is why people post here, a brief idea of the problem you are trying to solve is more useful. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Solution

Hi Guys

Thanks :ILA2:

my script is up and running.

I use it with Winpe on a USB boot disk.

Script:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $ExitID, $input

_Main()

Func _Main()
    Local $imagesID, $installID

    GUICreate("Imaging", 310, 80)

    GUICtrlCreateLabel("Please select a action!", 10, 10)
    $ImagesID = GUICtrlCreateButton("Images", 10, 50, 50, 20)
    GUICtrlSetOnEvent($imagesID, "OnYes")
    $installID = GUICtrlCreateButton("Install", 80, 50, 50, 20)
    GUICtrlSetOnEvent($installID, "OnNo")
    $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
    GUICtrlSetOnEvent($ExitID, "OnExit")

    GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")

    GUISetState()  ; display the GUI

    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main

;--------------- Functions ---------------
Func OnYes()
    Local $iLoop = 1
             While $iLoop = 1
                     $input = InputBox("Image name", "Enter path and file name")
                        If @error = 1 Then
                           MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
                        Else
                           if $input = FileExists("\\10.0.1.17\public\teknik_images\ibase\" & $input & ".gho") Then
    Else
         $iLoop = 0
    EndIf
EndIf
WEnd
EndFunc   ;==>OnYes to image

RunWait(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=restore,src=\\10.0.1.17\public\teknik_images\ibase\'& $input & '.gho,dst=1 -sure -auto',"")
Exit         

Func OnNo()
     $input = InputBox("Image install name", "Enter file name")
        If @error = 1 Then
            MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
EndIf
RunWait(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=create,src=1,dst=\\10.0.1.17\public\teknik_images\ibase\'& $input & '.gho -sure -auto',"")
Exit
EndFunc   ;==>OnNo

Func OnExit()
    If @GUI_CtrlId = $ExitID Then
        MsgBox(64, "Exit", "Imaging Canceled")
    Else
        MsgBox(64, "Cancel", "Action Canceled")
    EndIf

    Exit
EndFunc   ;==>OnExit

Gtek

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...