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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expanding my knowledge and would like some help

Status
Not open for further replies.

Crash171

Programmer
Sep 5, 2014
30
0
0
US
I now feel like I can do rather well with sending commands/keys with AttachMate and would like to try something a little harder. This would involve two things I have never done before, A Dialog Box and commanding Internet Explorer.

I would like to create a dialog box has the following choices:

[ul]
[li]Refresh every:[/li]
[li]1 Minute[/li]
[li]2 Minute[/li]
[li]3 Minute[/li]
[li]4 Minute[/li]
[li]5 Minute[/li]
[/ul]

[ul]
[li]Start[/li] [li]Then on a second screen: Stop[/li]
[/ul]

Each minute interval would send the CRTL-R key in a loop until the stop button was pressed. This CRTL-R would refresh a bucket within internet explorer.

How do I start? I want to truly know how to create and manipulate these things, so I would rather not have it written for me.
 
UPDATE

I used the dialog editor to design a dialog box, however now I don't know what to do with it. Also all of the OptionButtons have the "Invaliad OptionButton Control" error. Is this because they are not attached to anything yet?

Code:
Begin Dialog newdlg 186, 92
   OptionGroup .OptionGroup1
      OptionButton  20, 20, 50, 20, "1 Minute", .1MinuteButton
      OptionButton  70, 20, 50, 20, "2 Minutes", .2MinuteButton
      OptionButton  20, 40, 50, 20, "3 Minutes", .3MinuteButton
      OptionButton  70, 40, 50, 20, "4 Minutes", .4MinuteButton
      OptionButton  20, 60, 50, 20, "5 Minutes", .5MinuteButton
   Text  41, 6, 61, 15, "Refresh every:"
   PushButton  125, 18, 50, 20, "Start"
   PushButton  125, 40, 50, 20, "Pause"
   PushButton  125, 64, 50, 20, "Stop"
End Dialog
 
UPDATE 2

This is where I'm at now. Bold lines are where I'm getting Syntax Errors, Invalid OptionButton Control Errors, and Illegal Statements. Underlined lines are incomplete right now.


Code:
' Global variable declarations
[b]Global g_HostSettleTime%[/b]
[b]Global g_szPassword$[/b]

[b]Sub Main()[/b]
'--------------------------------------------------------------------------------
' Get the main system object
	Dim Sessions As Object
	Dim System As Object
	Set System = CreateObject("EXTRA.System")	' Gets the system object
	If (System is Nothing) Then
		Msgbox "Could not create the EXTRA System object.  Stopping macro playback."
		STOP
	End If
	Set Sessions = System.Sessions

	If (Sessions is Nothing) Then
		Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
		STOP
	End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
	g_HostSettleTime = 300		' milliseconds

	OldSystemTimeout& = System.TimeoutValue
	If (g_HostSettleTime > OldSystemTimeout) Then
		System.TimeoutValue = g_HostSettleTime
	End If

' Get the necessary Session Object
	Dim Sess0 As Object
	Set Sess0 = System.ActiveSession
	If (Sess0 is Nothing) Then
		Msgbox "Could not create the Session object.  Stopping macro playback."
		STOP
	End If
	If Not Sess0.Visible Then Sess0.Visible = TRUE
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	
 

  Dim IE as object
  Set objIE = CreateObject("InternetExplorer.Application")
[b]  .Visible = True
  .Navigate "[URL unfurl="true"]https://etms.verizon.com/ticketing/"[/URL][/b]

 
 
 
' Code starts below here!   

Begin Dialog newdlg 186, 92
   OptionGroup .OptionGroup1
[b]      OptionButton  20, 20, 50, 20, "1 Minute", .1MinuteButton
      OptionButton  70, 20, 50, 20, "2 Minutes", .2MinuteButton
      OptionButton  20, 40, 50, 20, "3 Minutes", .3MinuteButton
      OptionButton  70, 40, 50, 20, "4 Minutes", .4MinuteButton
      OptionButton  20, 60, 50, 20, "5 Minutes", .5MinuteButton[/b]
   Text  41, 6, 61, 15, "Refresh every:"
   PushButton  125, 18, 50, 20, "Start"
   PushButton  125, 40, 50, 20, "Pause"
   PushButton  125, 64, 50, 20, "Stop"
End Dialog

    
    
    
[u]Do Until Sess0.Screen.Sendkeys("CTRL+R")
    Application.Wait (Now + TimeValue("0:01:00"))
Loop
    
Do Until Sess0.Screen.Sendkeys("CTRL+R")
    Application.Wait (Now + TimeValue("0:02:00"))
Loop

Do Until Sess0.Screen.Sendkeys("CTRL+R")
    Application.Wait (Now + TimeValue("0:03:00"))
Loop

Do Until Sess0.Screen.Sendkeys("CTRL+R")
    Application.Wait (Now + TimeValue("0:04:00"))
Loop

Do Until Sess0.Screen.Sendkeys("CTRL+R")
    Application.Wait (Now + TimeValue("0:05:00"))
Loop[/u]
    
	System.TimeoutValue = OldSystemTimeout    
End Sub
 
Public rather than Global

Code:
'
  Dim IE as object
  Set objIE = CreateObject("InternetExplorer.Application")[b]
  With objIE
     .Visible = True
     .Navigate "[URL unfurl="true"]https://etms.verizon.com/ticketing/"[/URL]
  End With[/b]
 
Skip, I not get the error "objIE" is not a record type. Any clue on that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top