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

External programs

Status
Not open for further replies.

cheetahz

Technical User
Dec 4, 2008
101
US
I was wondering if it is possible to copy somthing from attachmate and paste it into an external webpage?
 
When you say webpage, do you mean like in Internet Explorer?

If so, then yes it is possible(At least in IE, not sure about other browsers).

 
it is a wbpage in IE only.
it is an internal page that would need to paste a group of numbers and then somehow hit a button to update - seems enter dont work. hmmmmm

any ideas or examples would be much appreciated

Thanks
 
If it is filling in a type of form, then you are going to have to dive into the source code of the webpage itself. Try to find the id's of the text boxes (where it'll say something similar to:

<input type = text name = "blah" id = "THIS RIGHT HERE">

NOTE: If there is no 'id', then 'name' will act as its replacement so you'll have to use that instead.

Code:
Dim IeApp As Object
Dim IeDoc As Object
Dim myStr As String

Set IeApp = CreateObject("InternetExplorer.Application")
Set IeDoc = IeApp.Document
myStr = "YOUR NUMBERS"
IeDoc.all("ID GOES HERE!").value = CStr(myStr)
IeDoc.all("submit").Click

NOTE: This is used for more simple pages. If it is used for more advanced pages such as a PeopleSoft system or something with frames. It may not work.


 
so here is the webpage code would the number go where NONE is listed and dont i have to list URL or window ID?

<FORM action="add.do" method="post"/>
<br> Number:
<input type=text name="number434804-523784" value="" onkeypress = "KeyDown()" />
<INPUT TYPE="hidden" name="docId"
value="434804-523784"></INPUT>
<INPUT type="hidden" name="Number" value="NONE"></INPUT>
<input
type="submit" value="Add to Case" />
&nbsp;&nbsp;
<a href='view.do?docId=434804-523784'>Save Image</a>
</FORM>
 
sorry i didnt see that you said if no ID use the name.

but how do i call the window dont i need to use the window ID or something?

Thanks again
 
In the code I showed IeDoc. When it is set to IeApp.Document, it takes the webpage associated with the IeApp Object. It basically does the same thing.
 
may be a silly question but after i copy the numbers that go in the webpage form how do i get them in the code you have?
or should i even be copying it?

thanks and sorry if i am missing something
 
this is going to save so much time and preventing errors
can you also search the code or webpage and run certain code based on if what you look for is found or not?


Thank you so much and sorry for all the question
 
this is what i am trying to use and i am getting an error

Set MyArea = MyScreen.Area(3,71,3,59,,3)
MyArea.Select
MyArea.Copy

Set IeApp = CreateObject("InternetExplorer.Application")
Set IeDoc = IeApp.Document
myStr = "MyScreen.Area"
IeDoc.all("434804-523784").value = CStr(myStr)
IeDoc.all("submit").Click
 
The error is an Object error on line
Set IeDoc = IeApp.Document
 
Oh, sorry. I forgot two small, but important parts of code that you'll need.

This one makes the page visible to you. Some things don't work unless it's visible.
Code:
IeApp.Visible = True


This one tells the program to wait while the page is loading.
Code:
While IeApp.Busy
        DoEvents
Wend

Hope this helps.

 
Oh, if you post code, it would make things a bit easier to read if you put it in [ code ] tags just to let you know.
 
Thank you i have been getting code from around this site and i will post it if needed but i think i need one more thing.

i need to search the text of another page
(the page dont have a visable url)
"but i can view the source"
and if the key word is found run 1st code else run 2nd code

is this possible?
an example if you have one

by the way thank you so much for the help!
 
OK, this is a scalled down version because i have like 4 scenerios that are possible depending on the text found see post above.

but i am getting an object error it wont let me create it.
the window is already open and the text needs posted into it and submitted. It seems if there was a way to reference the already open window that would be easier.

I tried some code i found here on the board but it didnt seem to work either it says cant find window but it went by url which if you try to open the window with a url it asks for a password is this why it cant create the object?


Code:
    '--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
' Session Document: "TN3270 MAINFRAME CONNECTION 1.EDP"
' Date: Friday, February 09, 2009 09:00:35
' User: 
'--------------------------------------------------------------------------------

' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
	Dim IeApp As Object
        Dim IeDoc As Object
        Dim myStr As String

        Dim Sessions As Object
	Dim System As Object
        Dim MyScreen As Object
        Dim MyArea 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 Sessions = System.ActiveSession
	Set MyScreen = Sessions.Screen

	CurrentRow = MyScreen.Row
	CurrentCol = MyScreen.Col
'--------------------------------------------------------------------------------
' Set the default wait timeout value
	g_HostSettleTime = 1000		' 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)
	
' This section of code contains the recorded events
	Sess0.Screen.Sendkeys("c83<Enter>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("u<Enter>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
        Sess0.Screen.Sendkeys("11<Tab><Tab><Tab>Acount Closed<Tab>u<Enter>")
        Sess0.Screen.Sendkeys("YY<Enter>")
        Sess0.Screen.Sendkeys("x<Tab>x<Tab><Enter>")

 


	
Sess0.Screen.Sendkeys("<Tab><Tab>")
If CurrentRow = 07 And CurrentCol = 04 Then
 

	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("X<Enter>")
        Sess0.Screen.Sendkeys("<Enter>")  	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
        Sess0.Screen.Sendkeys("some text<Tab>")
        Sess0.Screen.Sendkeys("some text")
	Sess0.Screen.Sendkeys("<Enter>")	
	
 
 
 Set MyArea = MyScreen.Area(3,71,3,59,,3)
	MyArea.Select
	MyArea.Copy
 
Set IeApp = CreateObject("InternetExplorer.Application")
Set IeDoc = IeApp.Document
myStr = Sess0.Screen.GetString(3,71,3,59,,3)
IeApp.Visible = True
While IeApp.Busy
        DoEvents
Wend
IeDoc.all("434886-525834").value = CStr(myStr)
IeDoc.all("submit").Click
 
 
 Sess0.Screen.Sendkeys("<V<Enter>>")

	System.TimeoutValue = OldSystemTimeout
 
End If
If (IeApp is Nothing) Then
          Msgbox "Could not create the IE object. Stopping Program."
          STOP
      End If
      If myStr ="" Then
           MsgBox "You must Finalizeto Return the Number"
        End If
End Sub
 
I posted the code do you see any problems?
i need to access already open windows one to paste a number and then update and another to search the text on the page to find a phrase and run some code if found.



I would really appreciate some help with this.
Thanks
 
well i pasted my code and no response?

anyway does anyone know a way to reference an already open explorer window by title or something


i need to search for some text on an external page
and also put a number in a form and submit it.

both windows are already open but they are on entranet(pass protected and cookie)
so i dont think i can create it as an object

Any help would greatly be appreciated
 



This may be of some help, although it is written in Excel VBA, much more robust than Extra Basic...
Code:
Function GetURLFrom_IE() As String
'SkipVought/2009 Jan 15
'--------------------------------------------------
':returns URLs from IE windows
'--------------------------------------------------
  Dim oShell As oect
  Dim oWindows As oect, oWindow As oect
    
  Set oShell = Createoect("Shell.Application")
  Set oWindows = oShell.Windows
  
  For Each oWindow In oWindows
    If Right(oWindow.FullName, 12) = "iexplore.exe" Then
      GetURLFrom_IE = GetURLFrom_IE & oWindow.LocationURL & ";"
    End If
  Next
  GetURLFrom_IE = Left(GetURLFrom_IE, Len(GetURLFrom_IE) - 1)
  Set oWindow = Nothing
  Set oWindows = Nothing
  Set oShell = Nothing
End Function

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
somewhat, but i am looking for a way to search the text on a webpage "like ctrlF"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top