Jump to content

ctrlCreateinput value to script via ctrl read


Recommended Posts

I made a script that works but as I am learning, I am trying to expand as well.

I am trying to make it where when the script is ran, a popup box comes up asking for user input. After the user inputs the data and clicks OK, that data is placed in the script. I also can't seem to get the script to continue after you click OK from the GUI. Below is what I have, Its really been bugging me and I feel like I am overlooking something really simple.

GUICreate("Enter Document Number", 300, 100) 
$file = GUICtrlCreateInput("W", 10, 5, 300, 20)
GUICtrlCreateButton("OK", 70, 50, 60)
GUISetState(@SW_SHOW)
Sleep(45000)


; Opens Command Prompt
Run("cmd.exe")


; What I want to be wrote in CMD
Send("SQLPLUS RUN AS SYSDBA{ENTER} {ENTER}DELETE FROM LOGMAINT.DCRHISTORY WHERE DOCUMENTNBR= 'GUICtrlRead($file)';{ENTER}")
Send("DELETE FROM LOGMAINT.DOCCTLREGISTER WHERE DOCUMENTNBR= 'GUICtrlRead($file)';{ENTER}")
Hello, Edited by SignalChief
Link to comment
Share on other sites

  • Moderators

SignalChief,

Welcome the the AutoIt forum. ;)

If you are looking for just the one piece of information, why not use InputBox? That way you block the script until you select a button on the dialog and the script then continues automatically. You save the user-inserted value in a variable and then use a bit of errorchecking to make sure something was actually entered.

Looking at the Send commands, you need to use the concatenation operator & to join strings. ;)

I would suggest something along these lines:

$file = InputBox("Enter Document Number")
If $file <> "" Then
    Run("cmd.exe")
    Send("SQLPLUS RUN AS SYSDBA{ENTER}{ENTER}DELETE FROM LOGMAINT.DCRHISTORY WHERE DOCUMENTNBR= " & $file & ";{ENTER}")
    Send("DELETE FROM LOGMAINT.DOCCTLREGISTER WHERE DOCUMENTNBR= " & $file & ";{ENTER}")
EndIf

Please ask if there are any questions. :)

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

Thanks for the welcome! Thanks for the quick response as well. I didn't know about the input box but it is definitely easier than what I was trying to do. Below is my final code that works. One last question though, is there a way for me to hide the commands that are given? Right now, when someone clicks on my .exe, it displays the commands and I don't want my users seeing that. I assume, I can use some type of "@echo off"? I am still searching as I type this.

$file = InputBox("Hero Tool","Enter Document Number you want to delete:","W")
If $file <> "" Then
    Run("cmd.exe")
    Send(" SQLPLUS RUN AS SYSDBA{ENTER}{ENTER}DELETE FROM LOGMAINT.DCRHISTORY WHERE DOCUMENTNBR= '" & $file & "';{ENTER}")
    Send("DELETE FROM LOGMAINT.DOCCTLREGISTER WHERE DOCUMENTNBR= '" & $file & "';{ENTER}COMMIT;{ENTER}")
EndIf
Link to comment
Share on other sites

  • Moderators

SignalChief,

Has your search got as far as _RunDOS yet? ;)

I have not used it, but it looks as if it does what you want.

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

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