How do I write a macro for if logged in?

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

How do I write a macro for if logged in?

Post by LAPIII » Sun Dec 06, 2009 1:15 pm

The following macro is to Log into iopus forums and go to Manage Subscriptions:

Code: Select all

VERSION BUILD=6251204 RECORDER=FX
URL GOTO=http://forum.iopus.com/viewforum.php?f=11
TAG POS=1 TYPE=A ATTR=TXT:Login
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:http://forum.iopus.com/ucp.php?mode=login ATTR=ID:username CONTENT=LAPIII
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:http://forum.iopus.com/ucp.php?mode=login ATTR=ID:password CONTENT=PASSWORD
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:login ATTR=NAME:login&&VALUE:Login
TAG POS=1 TYPE=A ATTR=TXT:User<SP>Control<SP>Panel
TAG POS=1 TYPE=SPAN ATTR=TXT:Manage<SP>subscriptions
TAG POS=1 TYPE=A ATTR=TXT:Manage<SP>subscriptions
I might go to a forum and then later want to come back to Manage Subscriptions via the macro, but I get hung up at the login.
Last edited by LAPIII on Wed Dec 09, 2009 2:01 pm, edited 3 times in total.
Marcia, Tech Support
Posts: 1094
Joined: Thu Jan 29, 2009 1:10 pm

Re: How do I write macro for if logged in?

Post by Marcia, Tech Support » Mon Dec 07, 2009 10:13 pm

Hello,

So, you would like to skip the login, if already logged in? Just use SET !ERRORIGNORE YES before the login and reset it to NO after the login:

Code: Select all

VERSION BUILD=6251204 RECORDER=FX
URL GOTO=http://forum.iopus.com/viewforum.php?f=11
SET !ERRORIGNORE YES
TAG POS=1 TYPE=A ATTR=TXT:Login
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:http://forum.iopus.com/ucp.php?mode=login ATTR=ID:username CONTENT=LAPIII
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:http://forum.iopus.com/ucp.php?mode=login ATTR=ID:password CONTENT=PASSWORD
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:login ATTR=NAME:login&&VALUE:Login
SET !ERRORIGNORE NO
TAG POS=1 TYPE=A ATTR=TXT:User<SP>Control<SP>Panel
TAG POS=1 TYPE=SPAN ATTR=TXT:Manage<SP>subscriptions
TAG POS=1 TYPE=A ATTR=TXT:Manage<SP>subscriptions
Regards,

Marcia
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: How do I write a macro for if logged in?

Post by LAPIII » Tue Dec 08, 2009 11:33 pm

I think what I wanted was a 'If not logged in already' macro. So if logged in, proceed. If not logged in, then do so.
Marcia, Tech Support
Posts: 1094
Joined: Thu Jan 29, 2009 1:10 pm

Re: How do I write a macro for if logged in?

Post by Marcia, Tech Support » Wed Dec 09, 2009 7:41 am

Hello,

There is no "if" in iMacros, I'm afraid. Please, see this FAQ.

But the SET !ERRORIGNORE YES works fine in this simple case.
Regards,

Marcia
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: How do I write a macro for if logged in?

Post by LAPIII » Wed Dec 09, 2009 2:30 pm

I'm thinking of a similar macro, but I don't know if this will still work. In the case that I'm logged into a Gmail account and want to log out in order to log into another Gmail account. I've got a macro that will automate this, except for the "In case part":

Code: Select all

VERSION BUILD=6251204 RECORDER=FX
URL GOTO=https://mail.google.com/mail/?shva=1#inbox
FRAME F=4
TAG POS=1 TYPE=A ATTR=TARGET:_top&&HREF:?logout&hl=en&&ID::qy&&CLASS:e<SP>a7<SP>ou
FRAME F=0
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:https://www.google.com/accounts/ServiceLoginAuth?service=mail ATTR=ID:Email CONTENT=XXXXX
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:https://www.google.com/accounts/ServiceLoginAuth?service=mail ATTR=ID:Passwd CONTENT=XXXXX
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:gaia_loginform ATTR=NAME:signIn&&VALUE:Sign<SP>in
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Re: How do I write a macro for if logged in?

Post by ABooth » Wed Dec 09, 2009 4:55 pm

Don't reinvent the wheel.Click here
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: How do I write macro for if logged in?

Post by LAPIII » Thu Dec 10, 2009 6:51 pm

Thanks ABooth! I want to avoid making Firefox slower, so I'll just deal with the macro. Now, I have a questions about the macro:

If I'm logged in already, can I avoid TAG WAITING?
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: How do I write a macro for if logged in?

Post by LAPIII » Tue Dec 22, 2009 11:38 pm

Can I make TAG WAITING shorter?
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: How do I write a macro for if logged in?

Post by MattBell7 » Wed Dec 23, 2009 3:20 pm

depends on which plugin your using, i believe in iMacros Browser you can override the setting with

Code: Select all

SET !TIMEOUT_TAG 5
failing that the tag timout is 1/10th of the main timeout, so just drop your maintime out really low, do the tag command, then set your timeout high again

e.g.

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT 5
TAG POS=1 TYPE=A ATTR=TXT:Create<SP>new<SP>user
SET !ERRORIGNORE NO
SET !TIMEOUT 60
Post Reply