Check if

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
dvd
Newbie
Posts: 5
Joined: Sat Feb 17, 2007 12:13 am

Check if

Post by dvd » Tue Aug 28, 2007 2:20 am

Hi,

I need little help.

1) Connect to internet
2) If net is connected then open XYZ application.
3) After opening XYZ application then click on O.K. button ( not fix position).
4) Exit (From upper right "x" icon.

edauthier
Pro Scripter
Posts: 84
Joined: Sun Apr 13, 2003 1:26 pm
Location: USA

Post by edauthier » Tue Aug 28, 2007 4:51 am

Kinda vague on a few things here..
1 and 2
What type of Internet connection do you have? Cable, DSL, etc.
Do you have a local Firewall or network FW to be concerned with?

Ok... so I might set up a a routine to ping 2 differing URLs and check their responses to identify Internet connectivity. You could also open your home page, but if it's cached you could have inconsistancy with your script.

Number 3
Is it a web-based app? Citrix/thin client?

dvd
Newbie
Posts: 5
Joined: Sat Feb 17, 2007 12:13 am

Post by dvd » Wed Aug 29, 2007 2:40 pm

Thanks for reply.
I am not sure about my connection.
It is broadband type using telephone line with external modem having details as:

Device Name : WAN Miniport
Device type : PPPoE
Server Type : PPP
Transports : TCP/IP
Authentication : MD5 CHAP.

I want to run application which is not web based such as CCleaner from CCleaner.com
Open application,click on "Run Cleaner" and then Exit.
I want to clean internet cookies on realtime basis , that's why I need check If internet connection is on.

Thanks

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Aug 29, 2007 4:03 pm

If you run RasDial it will tell you if you are not connected:

C:\>rasdial
No connections
Command completed successfully.

So you could do:

Code: Select all

Let>RP_WAIT=1
Run>cmd.exe /c Rasdial >> %TEMP_DIR%\rasdial.txt
ReadFile>%TEMP_DIR%\rasdial.txt,ras
Position>No connections,ras,1,rp
If>rp>0
  MessageModal>No Connection
Else
  MessageModal>Connected
Endif
DeleteFile>%TEMP_DIR%\rasdial.txt
If you want to know how to connect/disconnect see:

http://www.mjtnet.com/forum/viewtopic.php?t=1582
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

dvd
Newbie
Posts: 5
Joined: Sat Feb 17, 2007 12:13 am

Post by dvd » Fri Aug 31, 2007 2:42 pm

Thanks for help.

But I don't want message,instead
if net is connected only then and then xyz.exe executes.

Thanks

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Aug 31, 2007 4:22 pm

Untested modification of sample from Marcus:

Code: Select all

Let>RP_WAIT=1
Run>cmd.exe /c Rasdial >> %TEMP_DIR%\rasdial.txt
ReadFile>%TEMP_DIR%\rasdial.txt,ras
Position>No connections,ras,1,rp
If>rp<=0
   Run Program>xyz.exe
Endif
DeleteFile>%TEMP_DIR%\rasdial.txt
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

dvd
Newbie
Posts: 5
Joined: Sat Feb 17, 2007 12:13 am

Post by dvd » Sat Sep 01, 2007 2:24 pm

Sorry,....Not Worked

I want to clean internet cookies on realtime basis.That's why I need
if net is connected.....CCleaner.exe executes.

Thanks

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 01, 2007 3:04 pm

I may be mistaken but I don't think CC Cleaner operates on a realtime basis as you are suggesting. I think it is something you would run after an internet session to delete cookies and temp files, it doesn't sit there like a watchdog stopping those files being written. If you want realtime cookie prevention then why not set the browser not to accept them?

edauthier
Pro Scripter
Posts: 84
Joined: Sun Apr 13, 2003 1:26 pm
Location: USA

Post by edauthier » Sat Sep 01, 2007 4:48 pm

I am thinking that you can do everything you want to do with Macro Scheduler and will not require CC Cleaner.

If you look in the discussions and in the 'tips' and 'scripts' area you can put together a script that will automate and remove anything you'd like. The real-time throws me off a bit though. I guess you could run your cleaner app with MS in a loop/with a wait, or something to that effect.

At this point, I'd have to agree with Me_Again.

Ed

dvd
Newbie
Posts: 5
Joined: Sat Feb 17, 2007 12:13 am

Post by dvd » Sat Sep 01, 2007 5:16 pm

Yes, you are right.
By Realtime I mean when net is connected,cookies are to be deleted as they are stored.
But please reply
How I can apply
If net is connected ....then command.

Thanks

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 01, 2007 5:33 pm

I still don't understand why you wouldn't just stop the browser accepting cookies? If you keep running CC Cleaner every few minutes that will slow down your system.

edauthier
Pro Scripter
Posts: 84
Joined: Sun Apr 13, 2003 1:26 pm
Location: USA

Post by edauthier » Sun Sep 02, 2007 1:25 pm

dvd,
You've been provided with the If.. then.. did you happen to test the scripts above from Support and Bob Hansen? I think you've stated that it did not work. Pleaase post your version of the script.

Also, Me_again's suggestion resolves your issue entirely (i think). Are you not sure how to prevent cookies? If so, what browser are you using?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sun Sep 02, 2007 2:25 pm

Ed, I think we may not understand what "if net is connected" means. I suspect it may mean "if someone is accessing the internet = using a browser".

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Sep 02, 2007 5:14 pm

Me_again, you may be correct with your interpretation. It would definitely make a difference.

In any case, Ed's suggestion to just eliminate cookies is really the best answer.

And a sample of the script that is not working, maybe with a list of programs that are running, can certainly help us out.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts