if For Chrome

Discussions and Tech Support specific to the iMacros for Chrome extension.
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
User avatar
aytacesmebasi
Posts: 7
Joined: Tue Apr 28, 2020 10:22 am
Location: izmir, Turkey
Contact:

if For Chrome

Post by aytacesmebasi » Mon May 11, 2020 7:12 am

Hi from Turkey. I don't know how to write code. But i wrote the following using imacros browser. Then I tried it in chrome. But it doesn't work. Can you help me?

Code: Select all

VERSION BUILD=12.6.505.4525
TAB T=1
TAB CLOSEALLOTHERS
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
'SET !PLAYBACKDELAY 0.00
URL GOTO=https://www.tokbys.com/tokbys/Views/OrtakKarti.aspx?KartTip=1&kisiFid=10395e4cafab4050b135d53a92f85645
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxTbxTcKimlikNo EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL 
TAG POS=1 TYPE=A ATTR=TXT:"Ek Bilgiler"
TAG POS=1 TYPE=SELECT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxCmbVDairesi EXTRACT=TXT
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; if(s = e807d0f59c2345bea6c3737dbe05661a){var x = \"%035267\";} else (s = bb5c8f2ef5cf4785bdb2254c7901f24){var x = \"%035260\";}; x;")
SET !EXTRACT NULL 
URL GOTO=https://intvrg.gib.gov.tr/intvrg_side/main.jsp?token=d1078f5e3dc646b78d5d4e5842f21e97feb48d366bc7617458b6679dec12675154a01fccc42292bb04d926bc259dbc75e39dd8e202535fd70a7098396c74a6f7
TAG POS=2 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=P ATTR=ID:gen__1163
TAG POS=1 TYPE=A ATTR=TXT:"E-Vergi Levhası Sorgulama"
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:gen__1199 CONTENT={{!VAR1}}
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1200 CONTENT=%035
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT={{!VAR2}}
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:gen__1206
iMacros extension 10.0.5 is free
Chrome 81.0.4044.138 64bit
Windows 10.1909 64bit
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Mon May 11, 2020 10:57 am

aytacesmebasi wrote:
Mon May 11, 2020 7:12 am
Hi from Turkey. I don't know how to write code. But i wrote the following using imacros browser. Then I tried it in chrome. But it doesn't work. Can you help me?

Code: Select all

VERSION BUILD=12.6.505.4525
TAB T=1
TAB CLOSEALLOTHERS
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
'SET !PLAYBACKDELAY 0.00
URL GOTO=https://www.tokbys.com/tokbys/Views/OrtakKarti.aspx?KartTip=1&kisiFid=10395e4cafab4050b135d53a92f85645
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxTbxTcKimlikNo EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL 
TAG POS=1 TYPE=A ATTR=TXT:"Ek Bilgiler"
TAG POS=1 TYPE=SELECT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxCmbVDairesi EXTRACT=TXT
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; if(s = e807d0f59c2345bea6c3737dbe05661a){var x = \"%035267\";} else (s = bb5c8f2ef5cf4785bdb2254c7901f24){var x = \"%035260\";}; x;")
SET !EXTRACT NULL 
URL GOTO=https://intvrg.gib.gov.tr/intvrg_side/main.jsp?token=d1078f5e3dc646b78d5d4e5842f21e97feb48d366bc7617458b6679dec12675154a01fccc42292bb04d926bc259dbc75e39dd8e202535fd70a7098396c74a6f7
TAG POS=2 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=P ATTR=ID:gen__1163
TAG POS=1 TYPE=A ATTR=TXT:"E-Vergi Levhası Sorgulama"
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:gen__1199 CONTENT={{!VAR1}}
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1200 CONTENT=%035
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT={{!VAR2}}
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:gen__1206

Hum..., I hesitated to approve your Post/Thread as I'm rather dubious it is specific to the 'iMacros for CR' Sub-Forum (and you didn't read the Forum Rules), but I still approved it as you mentioned that it works in some "other" Browser and fails in CR... :?
Then OK, fair enough, and the Forum Admin will be able to move the Thread to the 'General' Sub-Forum if "needed"...

Then OK, start by reading the Forum Rules for some missing Tech Info...:
=> FCIM...! :mrgreen: (Read my Sig...)
iMacros for CR v10.0.5...?, 'Free'/'PE'...?, CR v81...?, OS = Win7/Win10...?

"But it doesn't work." is always pretty vague on a Tech Forum... :idea:
What is happening...?, do you get any (Runtime) Error...?, what Behaviour do you expect...?
(And disable '!ERRORIGNORE' also to make sure to "get" any RuntimeError...)

And hum..., if I look at your 'EVAL()' Statement...:

Code: Select all

SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; if(s = e807d0f59c2345bea6c3737dbe05661a){var x = \"%035267\";} else (s = bb5c8f2ef5cf4785bdb2254c7901f24){var x = \"%035260\";}; x;")
... I can't "really" believe it was "working" in iMB v12.6, as it contains several (Syntax) Errors... (x5) :?
OK, the JavaScript Runtime Engines built in all Browsers are somewhat "different" of course for all Browsers, and I know indeed of a few "slight" Differences, but the JS Runtime Engine for iMB (v12.6) would need to be very "tolerant" for your 'EVAL()' to "work"...! :?

>>>

:!: Hum..., and be "careful" about what you put in your Sig... :idea:
'We" don't like "too much" (fake) Users (mis)using the Forum and Search Engines to promote their own Site, if it's not iMacros related... :idea:
Last edited by chivracq on Mon May 11, 2020 11:39 am, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
aytacesmebasi
Posts: 7
Joined: Tue Apr 28, 2020 10:22 am
Location: izmir, Turkey
Contact:

Re: if For Chrome

Post by aytacesmebasi » Mon May 11, 2020 11:34 am

Sorry for writing fast without reading the rules. Thank you for approved. I promise to read the rules after solving this problem.

I use imacros browser 12.6.505.4525 (trial) and imacros extension chrome 81.0.4044.138 on windows 10.

I run this macros and i'm getting this error;

SyntaxError: Unexpected token '{', line: 12

The workplace I work for has more than one branch. each branch has a html code and a branch code. I am currently using two branch codes to try.

Code: Select all

SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; if(s = e807d0f59c2345bea6c3737dbe05661a){var x = \"%035267\";} else (s = bb5c8f2ef5cf4785bdb2254c7901f24){var x = \"%035260\";}; x;")
e807d0f59c2345bea6c3737dbe05661a is html code and %035267 branch code.

I am getting the html code in the code below.

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxCmbVDairesi EXTRACT=TXT
And i want to make entries here.;

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT={{!VAR2}}
iMacros extension 10.0.5 is free
Chrome 81.0.4044.138 64bit
Windows 10.1909 64bit
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Mon May 11, 2020 12:02 pm

aytacesmebasi wrote:
Mon May 11, 2020 11:34 am
Sorry for writing fast without reading the rules. Thank you for approved. I promise to read the rules after solving this problem.

I use

Code: Select all

imacros browser 12.6.505.4525 (trial) and imacros extension chrome 81.0.4044.138 on windows 10.


I run this macros and i'm getting this error;

Code: Select all

SyntaxError: Unexpected token '{', line: 12
The workplace I work for has more than one branch. each branch has a html code and a branch code. I am currently using two branch codes to try.

Code: Select all

SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; if(s = e807d0f59c2345bea6c3737dbe05661a){var x = \"%035267\";} else (s = bb5c8f2ef5cf4785bdb2254c7901f24){var x = \"%035260\";}; x;")
e807d0f59c2345bea6c3737dbe05661a is html code and %035267 branch code.

I am getting the html code in the code below.

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxCmbVDairesi EXTRACT=TXT
And i want to make entries here.;

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT={{!VAR2}}

Hum, OK, the Quality is getting better, good...! :D
(I added a Comment to my previous Post, about your Sig, while you were already typing/posting your Reply...)

"I promise to read the rules after solving this problem."
=> Beh, pfff...!, NO...!, not "after", but do it directly, or I might get "pissed off" if you "hit" another Forum Rule while I will have asked you to read them already, and I will simply stop helping you...! :roll:
"We" are already at Half a Forum Page just to get your FCI, while this Info should have been included in your OP if you had read the Forum Rules... :roll:

Your FCI is still not complete about CR, (the "F" in "FCI" stands for "FULL"...!, and you only had to check/answer all the Question Marks I had pre-put about your supposed FCI in my previous Reply...), but you still don't mention which Version of iMacros for CR you are using...?, even if I know it will be v10.0.5 as it is the only Version working on CR81, but I still need the 'Free'/'PE' Info...?

Then yep, I'm not surprised about the Syntax Error, but I'll "elaborate" once I've got your complete FCI...

And hum..., there will be stg "interesting" about your Case, as yep indeed, there will be "stg" where iMacros indeed behaves differently between iMB/IE and CR/FF, ah-ah...! It is documented in the Wiki (for the 'TAG' Command at the 'DDLB' Section... :idea: , but it's pretty rare that Users actually hit that Difference in Behaviour, there are only a few Threads on the Forum, in 12 Years of Forum Threads since 2008, ah-ah...! :twisted:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
aytacesmebasi
Posts: 7
Joined: Tue Apr 28, 2020 10:22 am
Location: izmir, Turkey
Contact:

Re: if For Chrome

Post by aytacesmebasi » Mon May 11, 2020 1:08 pm

my english is very bad I read your articles by translate from google. The following information is enough?
Your FCI is still not complete about CR
I download current version froum imacros web site.

iMacros Browser (x86) Version 12.6.505.4525
Released on 08.11.2019
Licensed Product: Trial Version
License Type: 30-day trial (12 days left)

imacros editor 12.6.0.190

imacros extension 10.0.5 is free

chrome 81.0.4044.138 64bit

windows 10.1909 64bit
iMacros extension 10.0.5 is free
Chrome 81.0.4044.138 64bit
Windows 10.1909 64bit
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Mon May 11, 2020 1:33 pm

aytacesmebasi wrote:
Mon May 11, 2020 1:08 pm
my english is very bad I read your articles by translate from google. The following information is enough?
Your FCI is still not complete about CR
I download current version froum imacros web site.

Code: Select all

iMacros Browser (x86) Version 12.6.505.4525
Released on 08.11.2019
Licensed Product: Trial Version
License Type: 30-day trial (12 days left)
imacros editor 12.6.0.190

Code: Select all

imacros extension 10.0.5 is free
chrome 81.0.4044.138 64bit
windows 10.1909 64bit

Alright...!, good, we finally have your FCI(s)...! :D
And this Info belongs to your OP when you open a Thread (preferably at the very top of your OP, that's the first Info I "look for" to decide if I will read a Post, and certainly answer...).

But, pfff..., you still haven't read the Forum Rules, because "good Intention" but your "new" Sig containing both FCI's for iMB + CR is now "breaking" another Rule...! :roll:
=> About NOT including your FCI in your Sig as this is only "confusing"... You only have 1 "Dynamic" Sig for the whole Forum and for all your Posts/Threads, => simply hard-code it in your OP, and don't use your Sig for that...

Again...!, if you could simply read the Forum Rules, that would "speed up the Process" considerably if you want some Help, and I wouldn't have to act like a "Pain in the Ass" until you've read them..., and comply/ied with them of course... :idea:
(You could already have gotten your Answer/Solution 2.5 Hours ago in my first Reply otherwise... :P )
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
aytacesmebasi
Posts: 7
Joined: Tue Apr 28, 2020 10:22 am
Location: izmir, Turkey
Contact:

Re: if For Chrome

Post by aytacesmebasi » Mon May 11, 2020 1:46 pm

now my english is over. I have to go back to work. my problem may be resolved or not resolved. I did not understand this situation. you are building a very long sentence. there are also abbreviations. these make translation difficult.

I will read the forum rules but it's too long and english. and i don't know english.

I guess it is not in the chrome that is in the imacros browser. if I understand it correctly.

Okay, don't give me fish, teach fishing is a good solution, but sometimes need to give that fish.

anyways

good forums, good bye.
iMacros extension 10.0.5 is free
Chrome 81.0.4044.138 64bit
Windows 10.1909 64bit
User avatar
aytacesmebasi
Posts: 7
Joined: Tue Apr 28, 2020 10:22 am
Location: izmir, Turkey
Contact:

Re: if For Chrome

Post by aytacesmebasi » Mon May 11, 2020 2:11 pm

My imb employee code

Code: Select all

VERSION BUILD=12.6.505.4525
TAB T=1
TAB CLOSEALLOTHERS
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
'SET !PLAYBACKDELAY 0.00
ONDIALOG POS=1 BUTTON=YES
URL GOTO=https://www.tokbys.com/tokbys/Views/OrtakKarti.aspx?KartTip=1&kisiFid=286b9ba1feb74bdfb5821adc4544d3c1
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxTbxTcKimlikNo EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL 
TAG POS=1 TYPE=A ATTR=TXT:"Ek Bilgiler"
TAG POS=1 TYPE=SELECT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxCmbVDairesi EXTRACT=TXT
SET !VAR2 EVAL("var text=\"{{!EXTRACT}}\"; if(text='ÇİĞLİ VERGİ DAİRESİ'){var x = '%035267';} else text=\"{{!EXTRACT}}\"; if(text='EGE VERGİ DAİRESİ'){var x = '%035268';}")
SET !EXTRACT NULL 
URL GOTO=https://intvrg.gib.gov.tr/intvrg_side/main.jsp?token=d1078f5e3dc646b78d5d4e5842f21e97feb48d366bc7617458b6679dec12675154a01fccc42292bb04d926bc259dbc75e39dd8e202535fd70a7098396c74a6f7
TAG POS=2 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=P ATTR=ID:gen__1163
TAG POS=1 TYPE=A ATTR=TXT:"E-Vergi Levhası Sorgulama"
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:gen__1199 CONTENT={{!VAR1}}
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1200 CONTENT=%035
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT={{!VAR2}}
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:gen__1206
TAG POS=1 TYPE=SPAN ATTR=ID:gen__1222 EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:gen__1226 EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:gen__1227 EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=kenks.csv
iMacros extension 10.0.5 is free
Chrome 81.0.4044.138 64bit
Windows 10.1909 64bit
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Mon May 11, 2020 2:44 pm

aytacesmebasi wrote:
Mon May 11, 2020 1:46 pm
now my english is over. I have to go back to work. my problem may be resolved or not resolved. I did not understand this situation. you are building a very long sentence. there are also abbreviations. these make translation difficult.

I will read the forum rules but it's too long and english. and i don't know english.

I guess it is not in the chrome that is in the imacros browser. if I understand it correctly.

Okay, don't give me fish, teach fishing is a good solution, but sometimes need to give that fish.

anyways

good forums, good bye.

Yeah, well, the Forum Rules are written in plain English, and without Abbreviations, it's not difficult to understand/translate:
* Always provide your FCI (Full Config Info), c.f. items 1-3 above, in your original post even if you think it may not be relevant.

Some of our mods may not even respond unless this information is included. Please don't put this information in your signature, because this can change over time and makes it more confusing when reviewing older posts. Include the information directly in the body of the post instead.
Sig = Signature
FCI = Full Config Info
OP = Opening Post
stg = something

But OK, never mind, I will still give you "the Solution" for this time, but I won't go through the same "Hassle" next time...

And tja...!, consider trying to improve a bit your English also, this is 2020...!, everybody in the World above 10 years old working "a bit" with Internet should be able to speak English "a bit correctly", or you'll be having a hard time with iMacros, all the Documentation and the Forum are in English... :idea:

>>>

Alright, I mentioned that iMacros behaves differently between iMB/IE and FF/CR when using DDLB's, explained/documented in the Wiki:
iMacros for Firefox/Chrome Note:

When you use the $, % and # symbols with variables, the symbols must be outside the {{..}}, so that iMacros can see the variable type while parsing. This is just as in any other scripting language where you have to declare the type before usage:

This will not work in iMacros For Firefox or Chrome:

Code: Select all

 'Example on how NOT to do it
 SET !VAR1 $*apple*
 TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT={{!VAR1}}
This works:

Code: Select all

 'Correct $,%,# usage
 SET !VAR1 *apple*
 TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=${{!VAR1}}
=> And your Line of Code when you try to reuse '!VAR2' is exactly hitting the "This will NOT work" Example with...:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT={{!VAR2}}
=> You will need to pull the "%" outside of the Var, and therefore outside also from the 'EVAL()', into stg like:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT=%{{!VAR2}}

OK, and now I'm being "very nice" and will "give some Fish to the Seals" as I guess getting you to understand and to correct all 5 Syntax Errors in your 'EVAL()' Statement, would take several Hours..., so here it is, and this one should work I think...:

Code: Select all

SET !EXTRACT NULL
TAG POS=1 TYPE=SELECT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxCmbVDairesi EXTRACT=TXT
'SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; if(s = e807d0f59c2345bea6c3737dbe05661a){var x = \"%035267\";} else (s = bb5c8f2ef5cf4785bdb2254c7901f24){var x = \"%035260\";}; x;")
SET !VAR2 EVAL("var s='{{!EXTRACT}}'; var brh1='e807d0f59c2345bea6c3737dbe05661a', brh2='bb5c8f2ef5cf4785bdb2254c7901f24', brc1='035267', brc2='035260'; var z; if(s==brh1){z=brc1;} else if(s==brh2){z=brc2;} else{z='ERROR';}; z;")
PROMPT EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>VAR2:<SP>_{{!VAR2}}_
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT=%{{!VAR2}}
Not tested of course... :|

And if you ever move to using the 'PE' Version, it would be possible to declare the 4 Branch Vars outside of the 'EVAL()', like at the beginning of your Script to make it more easily configurable, it's not very "easy" to work with multiple Vars with the 'Free' Version as you can only use '!VAR[1-3]' which forces you to write/use a bit "obscure" and not "Best Practice" Code... :|

(The 'Free' Version btw is meant for "Home Users", "Business Users" are "supposed" to get a 'PE' License... But don't "worry" about the Forum, I/we (Advanced Users) don't care about Licensing, the Forum is simply (Advanced) Users helping other Users... 8) )

Alright, I hope you like your Fish...! Enjoy...! :wink: :P
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Mon May 11, 2020 3:03 pm

aytacesmebasi wrote:
Mon May 11, 2020 2:11 pm
My imb employee code

Code: Select all

VERSION BUILD=12.6.505.4525
TAB T=1
TAB CLOSEALLOTHERS
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
'SET !PLAYBACKDELAY 0.00
ONDIALOG POS=1 BUTTON=YES
URL GOTO=https://www.tokbys.com/tokbys/Views/OrtakKarti.aspx?KartTip=1&kisiFid=286b9ba1feb74bdfb5821adc4544d3c1
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxTbxTcKimlikNo EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL 
TAG POS=1 TYPE=A ATTR=TXT:"Ek Bilgiler"
TAG POS=1 TYPE=SELECT ATTR=NAME:ctl00$MainContent$OrtakControl1$dxCmbVDairesi EXTRACT=TXT
SET !VAR2 EVAL("var text=\"{{!EXTRACT}}\"; if(text='ÇİĞLİ VERGİ DAİRESİ'){var x = '%035267';} else text=\"{{!EXTRACT}}\"; if(text='EGE VERGİ DAİRESİ'){var x = '%035268';}")
SET !EXTRACT NULL 
URL GOTO=https://intvrg.gib.gov.tr/intvrg_side/main.jsp?token=d1078f5e3dc646b78d5d4e5842f21e97feb48d366bc7617458b6679dec12675154a01fccc42292bb04d926bc259dbc75e39dd8e202535fd70a7098396c74a6f7
TAG POS=2 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=INPUT:BUTTON ATTR=CLASS:csc-button
TAG POS=1 TYPE=P ATTR=ID:gen__1163
TAG POS=1 TYPE=A ATTR=TXT:"E-Vergi Levhası Sorgulama"
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:gen__1199 CONTENT={{!VAR1}}
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1200 CONTENT=%035
TAG POS=1 TYPE=SELECT ATTR=ID:gen__1201 CONTENT={{!VAR2}}
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:gen__1206
TAG POS=1 TYPE=SPAN ATTR=ID:gen__1222 EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:gen__1226 EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:gen__1227 EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=kenks.csv

Oh...!?, hum, I see you've posted in the meantime some "other" Version of your Script, where the Logic inside your 'EVAL()' Statement is different from the one you had posted in your OP and that I used for my previous Post..., but if I "correct" this last one, that would give...:

Code: Select all

'SET !VAR2 EVAL("var text=\"{{!EXTRACT}}\"; if(text='ÇİĞLİ VERGİ DAİRESİ'){var x = '%035267';} else text=\"{{!EXTRACT}}\"; if(text='EGE VERGİ DAİRESİ'){var x = '%035268';}")
SET !VAR2 EVAL("var s='{{!EXTRACT}}'; var z; if(s=='ÇİĞLİ VERGİ DAİRESİ'){z='035267';} else if(s=='EGE VERGİ DAİRESİ'){z='035268';}; z;")
=> Only for '!VAR2', and remember that the "%" had to be pulled out of the 'EVAL()'... :!:
... And I didn't include some "ERROR" (Debug) Code in this one...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
aytacesmebasi
Posts: 7
Joined: Tue Apr 28, 2020 10:22 am
Location: izmir, Turkey
Contact:

Re: if For Chrome

Post by aytacesmebasi » Mon May 11, 2020 4:09 pm

Ok and thanks. Fish was very tasty nomnomnom :)

But if I understood correctly, there are opportunities for 4 branches. I have 37 branches. Working in the free version is a bit difficult.I haven't tried it yet imb can read from excel file but i think the extension is unable to read or I'm wrong because I haven't tried. Let me try to work with an excel file for branches list.

The reason there are two different text
(text='ÇİĞLİ VERGİ DAİRESİ'
(text='e807d0f59c2345bea6c3737dbe05661a'
application behaves differently according to the browser as you said. This tires and forces a person who does not know even more.

anyway

i repeat Fish was very tasty :) I'm sorry for being angry.
iMacros extension 10.0.5 is free
Chrome 81.0.4044.138 64bit
Windows 10.1909 64bit
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Tue May 12, 2020 4:20 am

aytacesmebasi wrote:
Mon May 11, 2020 4:09 pm
Ok and thanks. Fish was very tasty nomnomnom :)

But if I understood correctly, there are opportunities for 4 branches. I have 37 branches. Working in the free version is a bit difficult.I haven't tried it yet imb can read from excel file but i think the extension is unable to read or I'm wrong because I haven't tried. Let me try to work with an excel file for branches list.

Euh..., nope, the first Script I posted...:

Code: Select all

SET !VAR2 EVAL("var s='{{!EXTRACT}}'; var brh1='e807d0f59c2345bea6c3737dbe05661a', brh2='bb5c8f2ef5cf4785bdb2254c7901f24', brc1='035267', brc2='035260'; var z; if(s==brh1){z=brc1;} else if(s==brh2){z=brc2;} else{z='ERROR';}; z;")
... is for 2 Branches, not for 4...!, 'brh1' + 'brc1' are for Branch_1 and 'brh2' + 'brc2' are for Branch_2. I mentioned "4 Vars", not "4 Branches"... :roll:
You had only mentioned 2 Branches in your OP and in your Script(s), there is no Reason I could have come up with more than 2 Branches... :P
("brh" = "Branch HTML" and "brc" = "Branch Code".)

Both iMB (the Browser) and iMacros do support using a '.CSV' File as DataSource... 8)
And don't call it an 'Excel' File, 'Excel' is just one from more than 1000 Progs that can open and save '.CSV' Files... :roll:
True is that iMB 'Trial' is fully Functional and does indeed support the '!DATASOURCE' Command, while iMacros for FF/CR v10.0.x only support that Command for the 'PE' Version, and there is no 'Trial' Version for those 2 Browsers...

But hum, using a '.CSV' as a DataSource might not be "the best" Solution for 37 or 40 Entries in that Input File... :idea:
EDIT: The Purpose of a '.CSV' as DataSource is to loop that DataSource Row by Row with 1 Row per Loop, but in your Case, you would need to loop again and again through the whole DataSource for each Loop. Cumbersome to implement in pure '.iim', you would need a '.js' Script (with iMacros for FF v8.9.7) or the 'Scripting Interface' from iMB with the 'Enterprise Edition'.

"Funny" (= a bit annoying) how so many Users on the Forum "suffer" from "X/Y Problematic" and come to the Forum asking for a Solution for a Qt that turns out to be only the mini-visible part of a huge Iceberg, ah-ah...! :roll:
EDIT:
Even if, hum..., that "new" Parameter about the 37 Branches actually makes your Case/Scenario more Interesting than originally with "only" 2 Branches, ah-ah...! :twisted:

But OK, there are several Solutions/possible Implementations for your/that Scenario, but hum..., it will be a little bit more "complicated" than until now, I'm a bit "afraid" you won't "really" understand those possible "Solutions"..., and we'll both be spending/losing a lot of time, and I won't be writing your Script, ah-ah...!, maybe you can find some Colleague with hopefully a mini-bit of Programming Experience and who speaks/understands English a bit fluently...? (No Offense of course, ah-ah...!)

OK, I'll "quickly" mention (a few of) those possible Solutions/Implementations:
(And see if and what you "understand"... :wink: )

1- String/Array with all 37 Branches hard-coded in Script, x2 maybe for 'brh' and 'brc'.
(Works very quick, but not easy to maintain, 1 single mini-Typo in a very long Line that requires 20 Clicks/Screens for Horizontal Scrolling and the Script is broken..., and might hit some Size Limitation, but if you are on CR, then yep, CR has Size Limitations for Vars, not from iMacros but from CR itself...)
EDIT: And yep indeed applies to you, FCI not easy to find back, not mentioned in OP, but I think you are still "safe" with those 37x2 Strings...

2- Whole DataSource as '.TXT' File, can be extracted in 1 Statement, 'EVAL()' to further make the "Connection" between 'brh' and 'brc'...
(Would need some extra "Formatting" between all Cols..., + requires a 2nd Tab for the Script to run, at least once at the beginning, unless Looping..., DataSource easy to maintain...)

3- DataSource as '.html' File (from 'Excel').
(Also requires a 2nd Tab, DataSource easy to maintain..., as '.CSV' or pure 'Excel' File, but must resave the '.html' File after any Modif...)

... And there are a few other possible Solutions/Implementations, but I am afraid I'm just "talking in the Wind", ah-ah...! :(

EDIT:
About the 3 Options I've mentioned, I would go for Option 2 or 3, I think..., hum..., Option 3 then actually, as it doesn't need the extra Formatting... I guess that List of Branches doesn't often need to be edited... But you'll need a perfect Match between the Names on the Website and in your Local 'Excel' => '.html' File.

>>>
aytacesmebasi wrote:
Mon May 11, 2020 4:09 pm
The reason there are two different text
(text='ÇİĞLİ VERGİ DAİRESİ'
(text='e807d0f59c2345bea6c3737dbe05661a'
application behaves differently according to the browser as you said. This tires and forces a person who does not know even more.

anyway

i repeat Fish was very tasty :) I'm sorry for being angry.

"application behaves differently according to the browser as you said."
=> Nope, I never said that, ah-ah...! :? , only about 'DDLB' + 'CONTENT' with % that needs to be outside of the Var when using a Var, and this has nothing to do with the 'EXTRACT' Mechanism, ah-ah...!
The Result of 'EXTRACT' should be the same in all Browsers... 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Tue May 12, 2020 4:10 pm

Hum..., I edited "a bit" my previous Post, removed and added some parts... :wink:

And hum, maybe some "extra" Idea, about the 3rd Option I mentioned with a '.html' (Local) File...:
If this 'tokbys.com' Site is your "own" Company Site and you control its Content..., then you could maybe include that whole Content of the Double or Triple List with the 37 Branches in its HTML Source Code..., it doesn't need to be visible in the Browser, but iMacros would be able to extract its Content and from 1 'brh' or Text Value, convert to the corresponding 'brc' Value needed for the 2nd Site in your Script... :idea:

But..., whoever from your Company IT Dept maintains your Website would need to implement that Functionality "correctly", and that when the List with all 'brh' or Text Names gets modified, the List with the corresponding 'brc' Codes also gets automatically updated and dynamically generated from the same Source like that Page is already using for its own Functionality... :!:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
aytacesmebasi
Posts: 7
Joined: Tue Apr 28, 2020 10:22 am
Location: izmir, Turkey
Contact:

Re: if For Chrome

Post by aytacesmebasi » Wed May 13, 2020 3:07 pm

Hey dude! U r excelent. You officially teach fishing. And I solved the problem myself as follows. tried but it works.

Your ideas are very nice, I will use them for other works.

Edit: 4 limitations are also really sad. It has blocked some of my dreams. But there is nothing to do, I will consider other solutions.

Code: Select all

SET !VAR2 EVAL("var s='{{!EXTRACT}}'; var a1='fef00f84b6c1480893a26fc4ccbb7c48', a2='360a46bf9c25422482602ebf13b1710e', a3='7391b6a2dc484d028f825ffc4a2e39ea', a4='575e90700e784d0cbe2dd16eb3b6de9b', a5='36a2b17f10134c30ad339c47fbddebd4', a6='a8463dff3b284f2f8446f599fdc38ef0', a7='fad669cbb26741aeb45798270f59dc97', a8='4fd1df1e516c480bbb792def4bedae3d', a9='cffe2180cdbc4d209f1281cfd8ce2ae3', a10='74d801c245d84fd2bb8c7763c5d17b66', a11='cfded01a4ccb4ad598fad4400b86885a', a12='41777f553a5949feb06d3e071848e4c3', a13='d03002c1b93949f2943f2cbeb0d61944', a14='eb762e9c38e9485eaaec30648b375b51', a15='f5ae37fc11094a2b80176cf83b8c2898', a16='2afd2b7234934101b85a3b1035e5a800', a17='62e7d749b6d04f14bbd4d260217b9da6', a18='8a9e6fcc9bc541cf87513d7152f78be8', a19='4858b66ab7d541479f99825d2d68af22', a20='943fe55561cf432f9e268d91b090c572', a21='7c9e4d0a87074481ba15b0d76f93c4da', a22='53b9200557f64160ad705f8ebb2abd67', a23='9a0cd02e78aa40568aacf58356a69974', a24='dd588732792d42b881629269850a01f4', a25='030ed34993e8416a95495b7a64067568', a26='28b341dd6e784afeb4933c7b308cf93f', a27='bb5c8f2ef5cf4785bdb2254c7901f242', a28='2664ed9738764cff9e9c0517a0d28d04', a29='a2d66bf5dc554259831984498f275e55', a30='7eb64b83557944feaa8f22b3eaa63c04', a31='30bdda97b1bb4c96a80242fb4b6dc006', a32='cec16f42359f44db91ee37954993c30a', a33='ad55b5ae91f64d0385a28ce18c4f93ac', a34='1798cd0bb80343a6a6da8371f72abdc5', a35='08b32761f556425aa147b690c5d1e818', a36='b2592142da0642fd9dd280894f7f6838', b1='035105', b2='035106', b3='035107', b4='035114', b5='035120', b6='035201', b7='035202', b8='035203', b9='035204', b10='035205', b11='035206', b12='035207', b13='035208', b14='035209', b15='035210', b16='035211', b17='035212', b18='035213', b19='035215', b20='035251', b21='035252', b22='035254', b23='035256', b24='035257', b25='035258', b26='035259', b27='035260', b28='035261', b29='035262', b30='035263', b31='035264', b32='035266', b33='035267', b34='035268', b35='035269', b36='035270'; var z; if(s==a1){z=b1;} else if(s==a2){z=b2;} else if(s==a3){z=b3;} else if(s==a4){z=b4;} else if(s==a5){z=b5;} else if(s==a6){z=b6;} else if(s==a7){z=b7;} else if(s==a8){z=b8;} else if(s==a9){z=b9;} else if(s==a10){z=b10;} else if(s==a11){z=b11;} else if(s==a12){z=b12;} else if(s==a13){z=b13;} else if(s==a14){z=b14;} else if(s==a15){z=b15;} else if(s==a16){z=b16;} else if(s==a17){z=b17;} else if(s==a18){z=b18;} else if(s==a19){z=b19;} else if(s==a20){z=b20;} else if(s==a21){z=b21;} else if(s==a22){z=b22;} else if(s==a23){z=b23;} else if(s==a24){z=b24;} else if(s==a25){z=b25;} else if(s==a26){z=b26;} else if(s==a27){z=b27;} else if(s==a28){z=b28;} else if(s==a29){z=b29;} else if(s==a30){z=b30;} else if(s==a31){z=b31;} else if(s==a32){z=b32;} else if(s==a33){z=b33;} else if(s==a34){z=b34;} else if(s==a35){z=b35;} else if(s==a36){z=b36;} else{z='ERROR';}; z;")
iMacros extension 10.0.5 is free
Chrome 81.0.4044.138 64bit
Windows 10.1909 64bit
chivracq
Posts: 9721
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: if For Chrome

Post by chivracq » Wed May 13, 2020 4:35 pm

aytacesmebasi wrote:
Wed May 13, 2020 3:07 pm
Hey dude! U r excelent. You officially teach fishing. And I solved the problem myself as follows. tried but it works.

Your ideas are very nice, I will use them for other works.

Edit: 4 limitations are also really sad. It has blocked some of my dreams. But there is nothing to do, I will consider other solutions.

Code: Select all

SET !VAR2 EVAL("var s='{{!EXTRACT}}'; var a1='fef00f84b6c1480893a26fc4ccbb7c48', a2='360a46bf9c25422482602ebf13b1710e', a3='7391b6a2dc484d028f825ffc4a2e39ea', a4='575e90700e784d0cbe2dd16eb3b6de9b', a5='36a2b17f10134c30ad339c47fbddebd4', a6='a8463dff3b284f2f8446f599fdc38ef0', a7='fad669cbb26741aeb45798270f59dc97', a8='4fd1df1e516c480bbb792def4bedae3d', a9='cffe2180cdbc4d209f1281cfd8ce2ae3', a10='74d801c245d84fd2bb8c7763c5d17b66', a11='cfded01a4ccb4ad598fad4400b86885a', a12='41777f553a5949feb06d3e071848e4c3', a13='d03002c1b93949f2943f2cbeb0d61944', a14='eb762e9c38e9485eaaec30648b375b51', a15='f5ae37fc11094a2b80176cf83b8c2898', a16='2afd2b7234934101b85a3b1035e5a800', a17='62e7d749b6d04f14bbd4d260217b9da6', a18='8a9e6fcc9bc541cf87513d7152f78be8', a19='4858b66ab7d541479f99825d2d68af22', a20='943fe55561cf432f9e268d91b090c572', a21='7c9e4d0a87074481ba15b0d76f93c4da', a22='53b9200557f64160ad705f8ebb2abd67', a23='9a0cd02e78aa40568aacf58356a69974', a24='dd588732792d42b881629269850a01f4', a25='030ed34993e8416a95495b7a64067568', a26='28b341dd6e784afeb4933c7b308cf93f', a27='bb5c8f2ef5cf4785bdb2254c7901f242', a28='2664ed9738764cff9e9c0517a0d28d04', a29='a2d66bf5dc554259831984498f275e55', a30='7eb64b83557944feaa8f22b3eaa63c04', a31='30bdda97b1bb4c96a80242fb4b6dc006', a32='cec16f42359f44db91ee37954993c30a', a33='ad55b5ae91f64d0385a28ce18c4f93ac', a34='1798cd0bb80343a6a6da8371f72abdc5', a35='08b32761f556425aa147b690c5d1e818', a36='b2592142da0642fd9dd280894f7f6838', b1='035105', b2='035106', b3='035107', b4='035114', b5='035120', b6='035201', b7='035202', b8='035203', b9='035204', b10='035205', b11='035206', b12='035207', b13='035208', b14='035209', b15='035210', b16='035211', b17='035212', b18='035213', b19='035215', b20='035251', b21='035252', b22='035254', b23='035256', b24='035257', b25='035258', b26='035259', b27='035260', b28='035261', b29='035262', b30='035263', b31='035264', b32='035266', b33='035267', b34='035268', b35='035269', b36='035270'; var z; if(s==a1){z=b1;} else if(s==a2){z=b2;} else if(s==a3){z=b3;} else if(s==a4){z=b4;} else if(s==a5){z=b5;} else if(s==a6){z=b6;} else if(s==a7){z=b7;} else if(s==a8){z=b8;} else if(s==a9){z=b9;} else if(s==a10){z=b10;} else if(s==a11){z=b11;} else if(s==a12){z=b12;} else if(s==a13){z=b13;} else if(s==a14){z=b14;} else if(s==a15){z=b15;} else if(s==a16){z=b16;} else if(s==a17){z=b17;} else if(s==a18){z=b18;} else if(s==a19){z=b19;} else if(s==a20){z=b20;} else if(s==a21){z=b21;} else if(s==a22){z=b22;} else if(s==a23){z=b23;} else if(s==a24){z=b24;} else if(s==a25){z=b25;} else if(s==a26){z=b26;} else if(s==a27){z=b27;} else if(s==a28){z=b28;} else if(s==a29){z=b29;} else if(s==a30){z=b30;} else if(s==a31){z=b31;} else if(s==a32){z=b32;} else if(s==a33){z=b33;} else if(s==a34){z=b34;} else if(s==a35){z=b35;} else if(s==a36){z=b36;} else{z='ERROR';}; z;")

Hum, OK, so you went for Option 1, with the "long Line not easily maintainable", ah-ah...! But I'm still rather impressed you managed to implement it..., very good...! :D

I'm not completely sure I understand what you mean with the "4 limitations"..., but hum, you a Company, you would make your Life easier if you "invested" the 100E/$ in a 'PE' License anyway, to get all the Full Functionality and Features from the 'PE' Version... :idea:

I made some "Improvement"/Optimization to your Implementation, by declaring all Branch HTML Values and Branch Codes in 2 separate Vars ('!VAR1' + '!VAR2') outside the 'EVAL()', and using another Method to make the Correspondence between 'brh' and 'brc' which is much shorter than the 36x 'if'/'else' Sub-Statements you are using...

Here it is, demonstrated with only the first 5 Branches, you simply need to edit '!VAR1' and '!VAR2' to include all 36x Values for both...:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
TAB T=1

SET !VAR1 "a1='fef00f84b6c1480893a26fc4ccbb7c48', a2='360a46bf9c25422482602ebf13b1710e', a3='7391b6a2dc484d028f825ffc4a2e39ea', a4='575e90700e784d0cbe2dd16eb3b6de9b', a5='36a2b17f10134c30ad339c47fbddebd4'"
SET !VAR2 "b1='035105', b2='035106', b3='035107', b4='035114', b5='035120'"

SET !EXTRACT 7391b6a2dc484d028f825ffc4a2e39ea
SET !VAR3 EVAL("var s='{{!EXTRACT}}', brh='{{!VAR1}}', brc='{{!VAR2}}'; var x,y,z; x=brh.split(s); y=x[0].split(',').length; z=brc.split(',')[y-1].split('\\'')[1]; z;")
PROMPT brh:<BR>__{{!VAR1}}_<BR><BR>brc:<BR>_{{!VAR2}}_<BR><BR>EXTRACT:<SP>_{{!EXTRACT}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_
(Tested on iMacros for FF v8.8.2, PM v26.3.3, Win10_x64.)

I wrote it in one Go, and apart from 1 Typo I had (in the 'PROMPT'), I worked directly...! :P

The "SET !EXTRACT xxx" Line is for Testing, of course..., all the "Magic" is in the "x=brh.split(s); y=x[0].split(',').length; z=brc.split(',')[y-1].split('\\'')[1];" using the very powerful 'split()' JS Command/Method which does the same like your long 36x 'if'/'else'... It's a mini-bit "High Level", see if you understand what those x,y,z Sub-Statements do... (It's the same 3D "Deconstruct-Reconstruct" Principle like for solving the Rubik's Cube...!) 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply