Macros doesnt see js and gives error SyntaxError: unknown...

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 Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Macros doesnt see js and gives error SyntaxError: unknown...

by Sacmaseyler on Fri Nov 16, 2018 12:34 pm

VERSION BUILD=10021450
Windows 10 / English / Turkish

Macros does not see js. And also gives error SyntaxError: unknown command: VAR at line 1... I looked at solutions on the net but I could not handle it, Can someone help me ?

I opened notepad, copied to code and saved it as .js but iMacros doesnt see the js file and after that i changed sample .iim macro to js with code but I received an error about SyntaxError: unknown command: VAR at line 1. I don't think there is a problem in code, but I don't know reason of problem. How can i fix this...it's gonna be part of a simple trading bot, i deleted the iMacros and reinstalled again, i tried it on other versions of firefox...I tried to convert js code to iim but cant handle it. I saw some problems on the net sth like mine, they wrote you are trying to open js from iim file what does they mean but i changed the base file with js code but could not solve it.Please explain clear, My english is not good.Thank you.
Last edited by Sacmaseyler on Mon Nov 19, 2018 9:01 am, edited 2 times in total.
Sacmaseyler
 
Posts: 2
Joined: Fri Nov 16, 2018 10:34 am

Re: Macros doesnt see js and gives error SyntaxError: unknow

by chivracq on Sat Nov 17, 2018 1:15 am

Sacmaseyler wrote:
Code: Select all
VERSION BUILD=10021450
Windows 10 / English / Turkish


Macros does not see js. And also gives error SyntaxError: unknown command: VAR at line 1... I looked at solutions on the net but I could not handle it, Can someone help me ?

Code: Select all
var i = 0, macro, stat = [0], currentbid = 0, currentask = 0, toask = 0, tobid = 0, lobid = 0, hiask = 0, nextorder = 0, ordermore = 0, orderamount = 0, basebalance = ordermore = 0, assetbalance = 0, delta = 0, basemarket = String(prompt(" >> Welcome to BLOSHI Ver.1.1 << \n The bot follows only 1 rule: Buy Low and Sell High \n \n Type the base market for trading:", "BTC")), asset = String(prompt("Type the asset code to trade with:", "DNR")), bidstake = Number(prompt("Amount to bid/Buy-LO (in the base market currency):",
0.00035000)), askstake = Number(prompt("Amount to ask/Sell-HI (in the base market currency):", 0.00050000)), attempt = Number(prompt("How many BLOSHI attempts before cancelling all orders?", 3)), satoshidelta = Number(prompt("Minimum delta between bid and ask (satoshi or smallest coin unit):", 7)), mindelta = satoshidelta / 100000000;
function CheckHighestBid() {
  for (var a = 0; a < a + 1; a++) {
    if (macro = "CODE:", macro += "WAIT SECONDS=1\n", macro += "TAG POS=1 TYPE=SPAN ATTR=CLASS:market-summary-bid-price extract=txt\n", iimPlay(macro), stat[a] = iimGetExtract(), currentbid = stat[a], macro = null, -1 != stat[a].search(".")) {
      stat = null;
      stat = [0];
      break;
    }
  }
  return currentbid;
}
function CheckLowestAsk() {
  for (var a = 0; a < a + 1; a++) {
    if (macro = "CODE:", macro += "WAIT SECONDS=1\n", macro += "TAG POS=1 TYPE=SPAN ATTR=CLASS:market-summary-ask-price extract=txt\n", iimPlay(macro), stat[a] = iimGetExtract(), currentask = stat[a], macro = null, -1 != stat[a].search(".")) {
      stat = null;
      stat = [0];
      break;
    }
  }
  return currentask;
}
function getRandom() {
  return Math.floor(100 * Math.random()) + 1;
}
function CloseOrders() {
  macro = "CODE:";
  macro += "TAG POS=1 TYPE=A ATTR=TXT:Cancel<SP>All<SP>Orders\n";
  macro += "WAIT SECONDS=3\n";
  macro += "TAG POS=1 TYPE=BUTTON ATTR=ID:confirm-all-orders-cancel\n";
  macro += "WAIT SECONDS=10\n";
  iimPlay(macro);
  macro = null;
}
function ScanningMarket() {
  macro = "CODE:";
  macro += "URL GOTO=https://www.coinexchange.io/market/" + asset + "/" + basemarket + "\n";
  macro += "WAIT SECONDS=10\n";
  iimPlay(macro);
  macro = null;
}
function CheckBaseBalance() {
  for (var a = 0; a < a + 1; a++) {
    if (macro = "CODE:", macro += "WAIT SECONDS=1\n", macro += "TAG POS=1 TYPE=SPAN ATTR=ID:secondary-balance-clickable extract=txt\n", iimPlay(macro), stat[a] = iimGetExtract(), basebalance = stat[a], macro = null, -1 != stat[a].search(".")) {
      stat = null;
      stat = [0];
      break;
    }
  }
  return basebalance;
}
function CheckAssetBalance() {
  for (var a = 0; a < a + 1; a++) {
    if (macro = "CODE:", macro += "WAIT SECONDS=1\n", macro += "TAG POS=1 TYPE=SPAN ATTR=ID:primary-balance-clickable extract=txt\n", iimPlay(macro), stat[a] = iimGetExtract(), assetbalance = stat[a], macro = null, -1 != stat[a].search(".")) {
      stat = null;
      stat = [0];
      break;
    }
  }
  return assetbalance;
}
for (i = 0; i < i + 1; i++) {
  ScanningMarket(), CheckHighestBid(), CheckLowestAsk(), tobid = (100000000 * currentbid + 1) / 100000000, lobid = (100000000 * currentbid - 5) / 100000000, delta = currentask - currentbid, delta >= mindelta || (tobid = lobid), orderamount = nextorder = 100000000 * bidstake / 100000000 / tobid, CheckBaseBalance(), basebalance > bidstake && (macro = "CODE:", macro += "WAIT SECONDS=3\n", macro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:buy-form ATTR=ID:inputPrice CONTENT=" + tobid + "\n", macro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:buy-form ATTR=ID:inputAmount CONTENT=" +
  orderamount + "\n", macro += "WAIT SECONDS=3\n", macro += "TAG POS=1 TYPE=BUTTON FORM=ID:buy-form ATTR=ID:buy-order-submit\n", macro += "WAIT SECONDS=3\n", macro += "TAG POS=1 TYPE=BUTTON ATTR=ID:confirm-order-submit\n", macro += "TAG POS=1 TYPE=BUTTON ATTR=TXT:\u00d7Close\n", iimPlay(macro), orderamount = macro = null, orderamount = 0, nextorder = null, nextorder = 0, tobid = null, tobid = 0, lobid = null, lobid = 0, basebalance = null, basebalance = 0), ScanningMarket(), CheckLowestAsk(), CheckHighestBid(),
  toask = (100000000 * currentask - 1) / 100000000, hiask = (100000000 * currentask + 5) / 100000000, delta = currentask - currentbid, delta >= mindelta || (toask = hiask), orderamount = nextorder = 1E8 * askstake / 1E8 / toask, CheckAssetBalance(), assetbalance > orderamount && (macro = "CODE:", macro += "WAIT SECONDS=3\n", macro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:sell-form ATTR=ID:inputPrice CONTENT=" + toask + "\n", macro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:sell-form ATTR=ID:inputAmount CONTENT=" +
  orderamount + "\n", macro += "WAIT SECONDS=3\n", macro += "TAG POS=1 TYPE=BUTTON FORM=ID:sell-form ATTR=ID:sell-order-submit\n", macro += "WAIT SECONDS=3\n", macro += "TAG POS=1 TYPE=BUTTON ATTR=ID:confirm-order-submit\n", macro += "TAG POS=1 TYPE=BUTTON ATTR=TXT:\u00d7Close\n", iimPlay(macro), orderamount = macro = null, orderamount = 0, nextorder = null, nextorder = 0, toask = null, toask = 0, hiask = null, hiask = 0, assetbalance = null, assetbalance = 0), macro = "CODE:", macro += "WAIT SECONDS=5\n",
  iimPlay(macro), macro = null, ScanningMarket(), macro = "CODE:", macro += "WAIT SECONDS=10\n", iimPlay(macro), macro = null, 0 == i % attempt && CloseOrders();
}
;


I opened notepad, copied to code and saved it as .js but iMacros doesnt see the js file and after that i changed sample .iim macro to js with code but I received an error about SyntaxError: unknown command: VAR at line 1. I don't think there is a problem in code, but I don't know reason of problem. How can i fix this...it's gonna be part of a simple trading bot, i deleted the iMacros and reinstalled again, i tried it on other versions of firefox...I tried to convert js code to iim but cant handle it. I saw some problems on the net sth like mine, they wrote you are trying to open js from iim file what does they mean but i changed the base file with js code but could not solve it.Please explain clear, My english is not good.Thank you.

FCIM ...! :mrgreen: (Read my Sig...!)
=> Pfff..., FF Version not mentioned... :roll:

Eh beh, yep-yep, that's "unfortunately" "normal", oops...! v10.0.2 for FF doesn't support '.js' Scripts anymore... (mentioned in the Wiki and in the Released Notes btw...)...

Last Version to support '.js' Scripts on FF is v9.0.3, or even "better" v8.9.7, more Details if you had mentioned your FF Version... :wink:

>>>

Would help a bit also (for Readability) if you could use the ]CODE[ Meta-Tags, your parallel Post on SOF looks much better formatted than here (while Formatting is much easier here :wink: )...
=> Parallel Thread on SOF:
- iMacros does not see js. And also gives error SyntaxError: unknown command: VAR at line 1
(Contains a little bit more Info than here..., (hum, except FCI not mentioned on SOF...), but in some irritating "gonna/wanna" fake Chicago Street Kid Gangsta Language... :roll: )
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 7712
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Macros doesnt see js and gives error SyntaxError: unknow

by Sacmaseyler on Sat Nov 17, 2018 1:15 pm

Thank you sir..
Last edited by Sacmaseyler on Sun Nov 18, 2018 10:20 am, edited 1 time in total.
Sacmaseyler
 
Posts: 2
Joined: Fri Nov 16, 2018 10:34 am

Re: Macros doesnt see js and gives error SyntaxError: unknow

by chivracq on Sat Nov 17, 2018 6:49 pm

Sacmaseyler wrote::D You are best man of my day, I did with you. Thank you sir.. Thanks you for your words to me :D :lol:

Okay..., FF Version still not mentioned but if you want to be able to (still keep) use/using '.js' Scripts, you would need to (re)install iMacros for FF v8.9.7 that still works until FF56, recommended = FF v55.0.3. Maybe using a "parallel" FF Install with FF Portable for example, if you want your "main" FF to remain up-to-date with the latest Version, FF63 at the moment... :idea:

Hum, and I see that "your" Script actually comes from this Site, this User could/should indeed mention in their Instructions in which FCI they've tested it and in which FCI it will (still) work... But v8.9.7 for FF was indeed the current/stable Version at that time when they posted their Script in July 2017... :wink:

v8.9.7 for FF also works on PM27 btw, as they mention Pale Moon, which is actually even a "better" Option than plain FF... (Is also my Default Browser...) 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 7712
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to iMacros for Firefox

Who is online

Users browsing this forum: No registered users and 11 guests

-->