Sign in to follow this  
Followers 0
SignalChief

ctrlCreateinput value to script via ctrl read

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

I did come across that but I need to use the "send" function as my password is null. The other way won't let me do it unless I use command.com or command.exe. Anyway, thanks for assisting and helping expand my thoughts.

SignalChief

Share this post


Link to post
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
Sign in to follow this  
Followers 0