Skip to content

Commit

Permalink
Extract URL
Browse files Browse the repository at this point in the history
  • Loading branch information
A9T9 committed Sep 25, 2018
1 parent 74ba9d3 commit 524027d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 24 deletions.
33 changes: 9 additions & 24 deletions Powershell/SeeShell-ManyPlay-Demo.ps1
@@ -1,34 +1,19 @@
#
#
# This script shows how to concatenate many play commands.
#
# For the demo we splitted the Demo-Automate-Forms macro in 3 parts.
# Part 2 continues where Part 1 stopped, etc.
#
# Typically this concept is used to split a complex task in several sub-macros, for example:
# - Login (= Part 1)
# - DoSomething (Part 2A), and/or run DoSomethingElse (Part 2B)
# - Logout (Part 3)
#
# The demo uses SeeShell Browser, but the same concept applies to SeeShell Desktop Automation as well.
#
# V1.0 Sep 13, 2018, Initial version

$comObj = new-object -ComObject SeeShell #Desktop Automation
#or: $comObj = new-object -ComObject SeeShell.Browser #Web Automation

$comObj = new-object -ComObject SeeShell.Browser
$comObj.open(10)

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$comObj.Echo("Running Part 1")

# [System.Windows.Forms.MessageBox]::Show("Click OK to start the SeeShell Browser")
$i = $comObj.Play("Demo-ManyPlay-Part1")

if ($i -lt 0) {
[System.Windows.Forms.MessageBox]::Show("Error: "+ $i + $comObj.GetLastError())
}

#10 in open (10) is the max time to wait for the SeeShell Browser to start.
#If SeeShell Browser would take longer (e. g. very high CPU load) then the open command returns a timeout error

$comObj.open(10)

$comObj.Echo("Running Part 1")
$i = $comObj.Play("Demo-ManyPlay-Part1")
if ($i -lt 0) {[System.Windows.Forms.MessageBox]::Show("Part 1 error: "+ $i + " " + $comObj.GetLastError())}

$comObj.Echo("Running Part 2")
$i = $comObj.Play("Demo-ManyPlay-Part2")
Expand Down
34 changes: 34 additions & 0 deletions VBS/Extract-URL/Extract-URL.vbs
@@ -0,0 +1,34 @@
option Explicit

dim myBrowser, i, s, allData, data, line

set myBrowser = CreateObject ("seeshell.browser")

i = myBrowser.open(true)


i = myBrowser.echo ("first macro")
i = myBrowser.Play("testtab1")

if i < 0 then msgbox "Error playing macro: " + cstr(i) + vbCrLf + vbCrLf +"Text: "+myBrowser.getLastError()

'Get URL
allData = myBrowser.GetExtractImageData()

'The data is separated by [DATA] for each EXTRACTADD command
data = Split(allData, "[DATA]")
msgbox "Next macro will use this URL: " +data(0) 'FIRST element has index = 0

'Restart SeeShell (optional)
i = myBrowser.close()
i = myBrowser.open(true)

i = myBrowser.setVariable ("starturl", data(0))

i = myBrowser.play("TestTab2")
if i < 0 then msgbox ("Play error: " + cstr (i) +" " +myBrowser.getLastError())

msgbox ("Press OK to close the SeeShell Browser.")
i = myBrowser.close()

WScript.Quit(i)
Binary file added VBS/Extract-URL/TestTab1.see
Binary file not shown.
Binary file added VBS/Extract-URL/TestTab2.see
Binary file not shown.

0 comments on commit 524027d

Please sign in to comment.