SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Triggering a Macro question
Goto page 1, 2  Next
 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Triggering a Macro question
Author Message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Triggering a Macro question Reply with quote
Would it be possible to when you are on a certain web page to have a macro kick in?

Say i go to XYZ.com, Automation Suite kicks in and runs whatever the macro i have does.
Thu Jun 05, 2008 12:48 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
I'm not sure what the scope of this automation is - monitoring access to certain pages or automating data retrieval and submission from/to certain sites?

If monitoring, just make a job to run in the background all the time and watch for web browser windows with a certain title. When found, kick of other job(s) using JobRun or RunAndWait.

If data automation, use WebGetFile, WebPostData and similar methods to get or send data.
Thu Jun 05, 2008 12:57 am View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
What I do is I usually have a web page open, and it runs thru several things on it's own. which usually takes about 4 mins.
Once I get to one particular page I just want a macro to kick off to do it's OWN thing which ends up back at the beginning page that goes thru it's own thing again.
I figured out how to use the Macro Recorder easily.
Basically this would run all day. The way I am running it now is on a timer that every 5 mins. Of course if there is any lag, there's the potential that it will kick the macro off before needed.
I honestly have no clue how to set up a job to monitor for a certain page. I've gone thru the examples and none seem to do what I need (at least not that i can understand)
Thu Jun 05, 2008 10:34 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
To setup a job to monitor a particular page opening, you can do something like below using a JAL script job in 24x7

Code:
Dim handle, number
LoopWhile true, EndOfLoop
   WindowFind( "Your web page title here - as you see it in the title bar of the browser", handle )
   If Handle, Found, NotFound
   Found:
      // do something here, for example, MessageBox "The page is opened, hooray!"
   NotFound:
      Wait 10
EndOfLoop:

Thu Jun 05, 2008 12:01 pm View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
Code:
Dim handle, number
LoopWhile true, EndOfLoop
   WindowFind( "MoMA - Windows Internet Explorer", handle )
   If Handle, Found, NotFound
   Found:
      MessageBox( "YAY" )
   NotFound:
      Wait 10
EndOfLoop:


I set it to run "All Day" but I have to set a timer. Once that timer expired, the page wasn't there, the job disabled itsef. I made SURE the page was there, the timer ran out and no box popped up and the job disabled itself.
I decided to set it to run on "No Schedule" and nothing at all happened.

This is what is used to run the macro in the job:
Code:
Dim( macro, string )
FileReadAll( "C:\\Documents and Settings\\Jason\\Desktop\\MoMA.mcs", macro )
MacroPlayBack( macro, 0, 1, True )


If this gets figured out, I expand the code to:

Code:
Dim( handle, number, macro, string )
LoopWhile true, EndOfLoop
   WindowFind( "MoMA - Windows Internet Explorer", handle )
   If Handle, Found, NotFound
   Found:
      FileReadAll( "C:\\Documents and Settings\\Jason\\Desktop\\MoMA.mcs", macro )
      MacroPlayBack( macro, 0, 1, True )
   NotFound:
      Wait 10
EndOfLoop:


correct?
Thu Jun 05, 2008 1:00 pm View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
SysOp wrote:
To setup a job to monitor a particular page opening, you can do something like below using a JAL script job in 24x7

Code:
Dim handle, number
LoopWhile true, EndOfLoop
   WindowFind( "Your web page title here - as you see it in the title bar of the browser", handle )
   If Handle, Found, NotFound
   Found:
      // do something here, for example, MessageBox "The page is opened, hooray!"
   NotFound:
      Wait 10
EndOfLoop:


Actually, just looked at the log for this job, and it says there's a syntax error on line 2
Thu Jun 05, 2008 1:05 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
I gave you this code snippet just an idea of how it can be implemented. I din't try running it. It is up to you to finish and polish the script. I suggest you take a look in the manual at what each command referenced in this script is doing, so you can understand the logic behind and make the required changes.

The job should be setup to start on the scheduler startup (only once) and must be setup to run as an synchronous process so that it doesn't block the associated job queue. The job will run no stop running an infinite loop with 10 seconds pauses between checks. You can change 10 to a shorter interval, but then it will make your system busier, which you likely don't want. You may need to experiment with that and find out a good number appropriate for your system.

Hope this helps.
Thu Jun 05, 2008 1:16 pm View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
I'm sorry, but I have looked and I can't figure out how to get this to work at all.
The help files show a lot of information, but none of it is even close to helping me with what I want to do.
I'm running the job right now to kick off the macro every 5 mins as I need it to, but since I'm getting an error on the 2nd line with your snippet I can't do anything else.

Maybe if someone else can help me and actually give me the code that I need it would be better.
Wed Jun 11, 2008 10:12 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
Here is the correct code. You still need to fill in the blanks

Code:
Dim handle, number
Dim forever, boolean, true
LoopWhile forever, EndOfLoop
   WindowFind( "Your web page title here - as you see it in the title bar of the browser", handle )
   If Handle, Found, NotFound
   Found:
      // do something here, for example, MessageBox "The page is opened, hooray!"
   NotFound:
      Wait 10
EndOfLoop:

Wed Jun 11, 2008 11:14 am View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
Code:
Dim handle, number
Dim forever, boolean, true
Dim macro, string
LoopWhile forever, EndOfLoop
      WindowFind( "MoMA - Windows Internet Explorer", handle )
   If Handle, Found, NotFound
   Found:
FileReadAll( "C:\\Documents and Settings\\Jason\\Desktop\\MoMA.mcs", macro )
MacroPlayBack( macro, 0, 1, True )
   NotFound:
      Wait 10
EndOfLoop:


Doesn't work. Try to debug it, runs the script correctly but then freezes 24x7 permanently on the Wait 10, try to close, crashes 24x7
Also tried with the Dim macro, string in the "Found" loop. Same results, don't work, debug freeze & crash.
So, it still does not work.
Sun Jun 15, 2008 2:43 pm View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
ok, slight correction, it works ONCE, and only if i start 24x7 when the page is up.
Then it stops.
I need it to run continuously.
Sun Jun 15, 2008 2:57 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
Of course, in debug mode it runs only once. To run it properly, you should set the job to start on the "scheduler startup" event and let the scheduler start the job. "On startup" is one of the predefined schedule types. Also please ensure the job is set to run asynchronous so that it runs in the background and doesn't block other jobs in the same queue.

The job will only abort if an error occurs. To avoid such aborts on errors, set the job mode to "ignore errors"

By the way, wait 10 makes it go into sleep mode for 10 seconds, you cannot stop the job in this mode while in the debugger, yet in a regular mode if the job is set to run detached you can kill it using the queue monitor utility. In that utility, switch to the background queue, select the job and then choose Kill Job menu command.
Sun Jun 15, 2008 8:18 pm View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
Asyncronous/background process IS checked.
On 24x7 Scheduler start up IS selected.
Disable this job on error IS unchecked.
Ignore execution errors for this job IS checked.
Script does not execute unless i start 24x7 while on the page, and then never executes again, unless i click "Run Now," and then it NEVER stops running. every 10 seconds it continuously runs the macro and I am not even ON the page that it is supposed to be on. It just finished running 6 times in the past 60 seconds.
Sun Jun 15, 2008 8:52 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
Quote:
Script does not execute unless i start 24x7 while on the page, and then never executes again, unless i click "Run Now," and then it NEVER stops running. every 10 seconds it continuously runs the macro and I am not even ON the page that it is supposed to be on. It just finished running 6 times in the past 60 seconds.


Perhaps, I am missing something. Did you mean to say that 24x7 is not running when the page is opened or the job is not doing what you expect it to be doing? If the first, nothing is going to run, the scheduler should be running all the time and not as a service, in order to be able to monitor applications running on the interactive desktop. If the second, the title you specified as a filter in the script, doesn't match the actual title. Are you sure the title is "MoMA - Windows Internet Explorer?" Try something simpler, for example "MoMA%"

To verify the job is running use either Job Monitor or Queue Monitor. When using "Run Now" you are creating a second instance of the same job. Every time you click Run Now you create another instance.

Please take a look at the job log. I am pretty sure you will find some helpful messages in the log that will help you figure out the cause of the issue.
Sun Jun 15, 2008 9:24 pm View user's profile Send private message
Vitae1313



Joined: 05 Jun 2008
Posts: 11
Country: United States

Post Reply with quote
The job is not doing what it is supposed to. I am running the scheduler, but when the page loads up, it does nothing.

I know the title is correct because I copied and pasted it straight from the macro that recorded it.

There is nothing to look at in the job log if the job does not execute.

BTW, Thank you for alerting me to the Job Monitor. It showed me that many built in jobs by you, were running every 10 seconds on my computer that I did not want running. Not sure why these jobs that come with your program were running, and every time I disabled one, another one would come and take it's place. After disabling 6 jobs, and after 10 minutes of working at it I figured out how to make my own Job Database and use that instead.
Either way, the Job Monitor and Job Queue are both blank
Mon Jun 16, 2008 1:38 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.