Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access to window.event.key, Creating a pause feature

Status
Not open for further replies.

UnclScott

Technical User
Jan 22, 2013
24
US
Hello everyone

Let me preface this with, i'm on Windows 8, with IE 11. Already fixed the ScrollToView...

So here's my situation, i have 10k+ mp3's and i have a freeware program that doesn't support batch processing :( So naturally i wrote a script that reads a file name, and enters it into the program, presses a few keys, then gets the next name to the EoF. Pretty straight forward stuff. Inside the vbscript, i have a class for an IE "LogBox" to show me where it is in the overall progress; each file takes about 18 seconds to process.

The display updates with
Count: 1 Time: 23 s File: x:\music\artist\album\track 01 (01).mp3
...

It runs without intervention ~ the PC is not in use while the script is running. Only thing is, here or there, i actually need to use my PC, so what i'm looking to do is, detect if a key is pressed ~ i know, i know.

My goal is to get the script to Pause when i need it too ~ i don't really care how. The only exception is the cscript option ~ no console.

I'm thinking, there should be a way through InternetExplorer.Application to get access to External.Window.Event.KeyCode ( only thing i found online when searching ). In my logbox class i have oIE.Navigate "about:blank" and everything set to 0. My error message is: Object doesn't support this property or method.

So in the main script i would have something like

Code:
Set lB = New LogBox
StopForDay = False
Do While not ( Eof OR StopForDay )

 If Check lB.keyPress state Then
  If key = pause option
    msgbox click ok to continue
  Else
    StopForDay = True
  End If

 'copy, paste, run, update log, other stuff

Loop

Class LogBox ' the standard subs and properties are included ~ terminate, init, etc
 Private oIE, hght, wdth

 Private Sub Class_int
  Set oIE = CreateObject( "InternetExplorer.Application" )
  ' inits variables
 End Sub

 Public Property Get keyPress
   keyPress =  'this is what i can't figure out :s
 End Property

 Private Sub moveToBottom()
  oIE.Document.body.scrollTop = oIE.Document.Body.scrollTop + oIE.Document.Body.scrollHeight
 End Sub

 Public Sub WriteLine ( ByVal str )
  Write str & "<br />"
  moveToBottom
 End Sub

End Class

Anyone know of a way through vbscript to detect a key press, maybe a click? How-do/would-i write something for the oIE to always write a button after each log entry? I don't know, but i could use some help. Currently, when i stop, i manually go into the file and delete the lines it has already processed...

So thank you for taking some time to look this over, and thank you for your help.

~Scott

Ps: if need be, i'll upload my script
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top