au3scr Posted October 18, 2007 Share Posted October 18, 2007 I need to type Drive letter like C:\ or A:\ or F:\ and so on bu this function dont wait untill i type it. expandcollapse popupFunc df() $line = _GUICtrlEdit_GetLineCount ($CommandInput) - 1 $Input = _GUICtrlEdit_GetLine ($CommandInput, $line) HotKeySet("{enter}") ClipPut("Iinsert Drive Letter :" & @CRLF & "shell:") Send("^v{enter}") $string = StringTrimLeft($Input, 6) ;~ run("notepad") $VOL = DriveGetLabel($string) $SERIAL = DriveGetSerial($string) $TOTAL = DriveSpaceTotal($string) $FREE = DriveSpaceFree($string) $FS = DriveGetFileSystem($string) $Total2 = $TOTAL / 1000 $free2 = $free / 1000 $Used = $total - $free $Used2 = $used / 1000 $total3 = Round($total2,2) $used3 = Round($used2,2) $free3 = Round($free2,2) $percentused = $used3 / $total3 * 100 $percentusedrounded = Round($percentused,1) $freepercent = 100 - $percentusedrounded ClipPut(@CRLF) Send("^v{enter}") ClipPut("Volume Label " & $VOL) Send("^v{enter}") ClipPut("Total size of C:\ " & $TOTAL3 & " Gb") Send("^v{enter}") ClipPut("Free space on C: " & $FREE3 & "Gb (" & $freepercent & " %)" ) Send("^v{enter}") ClipPut("Disk C:\ S\N " & $SERIAL) Send("^v{enter}") ClipPut("Drive C\: File System " & $FS) Send("^v{enter}") ClipPut("Drive C:\ used " & $Used3 & "Gb (" &$percentusedrounded & " %)" ) Send("^v{enter}") HotKeySet("{enter}", "read_func") EndFunc ;==>df Full script with old df functionexample.au3 Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 18, 2007 Share Posted October 18, 2007 I need to type Drive letter like C:\ or A:\ or F:\ and so on bu this function dont wait untill i type it. expandcollapse popupFunc df() $line = _GUICtrlEdit_GetLineCount ($CommandInput) - 1 $Input = _GUICtrlEdit_GetLine ($CommandInput, $line) HotKeySet("{enter}") ClipPut("Iinsert Drive Letter :" & @CRLF & "shell:") Send("^v{enter}") $string = StringTrimLeft($Input, 6) ;~ run("notepad") $VOL = DriveGetLabel($string) $SERIAL = DriveGetSerial($string) $TOTAL = DriveSpaceTotal($string) $FREE = DriveSpaceFree($string) $FS = DriveGetFileSystem($string) $Total2 = $TOTAL / 1000 $free2 = $free / 1000 $Used = $total - $free $Used2 = $used / 1000 $total3 = Round($total2,2) $used3 = Round($used2,2) $free3 = Round($free2,2) $percentused = $used3 / $total3 * 100 $percentusedrounded = Round($percentused,1) $freepercent = 100 - $percentusedrounded ClipPut(@CRLF) Send("^v{enter}") ClipPut("Volume Label " & $VOL) Send("^v{enter}") ClipPut("Total size of C:\ " & $TOTAL3 & " Gb") Send("^v{enter}") ClipPut("Free space on C: " & $FREE3 & "Gb (" & $freepercent & " %)" ) Send("^v{enter}") ClipPut("Disk C:\ S\N " & $SERIAL) Send("^v{enter}") ClipPut("Drive C\: File System " & $FS) Send("^v{enter}") ClipPut("Drive C:\ used " & $Used3 & "Gb (" &$percentusedrounded & " %)" ) Send("^v{enter}") HotKeySet("{enter}", "read_func") EndFunc ;==>df Full script with old df function So, where is it you expect to be prompted for a drive letter? I don't see anything in that code that will wait for any input at all. 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 More sharing options...
ResNullius Posted October 18, 2007 Share Posted October 18, 2007 So, where is it you expect to be prompted for a drive letter? I don't see anything in that code that will wait for any input at all. I think au3scr probably wants something like this UNTESTED!!! Func df() HotKeySet("{enter}") $DrivePrompt = " Insert Drive Letter :" ClipPut(@CRLF & @CRLF & $DrivePrompt) Send("^v") Do $line = _GUICtrlEdit_GetLineCount ($CommandInput) - 1 $Input = _GUICtrlEdit_GetLine ($CommandInput, $line) Sleep(100) Until StringRegExp($Input, "(?i)[a-z]:\\", 0) If StringInStr($Input, $DrivePrompt) Then $string = StringReplace($Input, $DrivePrompt, "") Else $string = $Input EndIf ;rest of function @au3scr Wouldn't you be better off using ControlSend or ControlSetText instead of all the ClipPuts and pasting? PS: When I first saw your sig, I smiled and immediately thought "Hey, not to worry: I am old and silly a lot" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now