Page 42 of 96

Posted: Thu Jul 12, 2012 3:34 am
by wallywalters
FeyFre and Vistor7, my thanks. I'm trying to get them working and learn from them both.

Posted: Sun Jul 15, 2012 2:40 pm
by KDJ
MapNetDrive.js

Now the script can be run in AkelPad window or directly, in the command line.

Posted: Sun Jul 15, 2012 3:43 pm
by KDJ
The following picture shows two windows of MapNetDrive.js script.
On the left - the script runs from AkelPad.
On the right - the script runs from command line.
Can someone explain to me why the buttons have a different shape and color?

Image

Posted: Sun Jul 15, 2012 6:29 pm
by FeyFre
KDJ, it is probably because of DLLHELL ;) Akelpad.exe have own common controls manifest, where in dependencies requirement of Common controls 6.0 (with nice round corners and other shapes). But Wscript.exe does not have such manifest. Try to create one(borrow somewhere), name it wscript.exe.manifest and put near wscript.exe.

Posted: Sun Jul 15, 2012 8:06 pm
by KDJ
FeyFre
Excellent, this is what was needed!
I borrowed a manifest from Instructor (AkelPad.exe.manifest).
It works beautifully.
Thank you very much.

Posted: Sun Jul 15, 2012 8:33 pm
by FeyFre
KDJ, don't forget to rename assembly (name attribute of assemblyIdentity tag). It could provoke unknown side-effects.

Posted: Mon Jul 16, 2012 8:06 am
by KDJ
FeyFre
What name would be appropriate? Could it be "wscript"?

XP Style Hacker - manifest file generator

Posted: Mon Jul 16, 2012 3:28 pm
by Surveyor
I have run into similar problems with software (under Win XP SP3) which required a manifest file. You can generate your own using XP Style Hacker, available here:

http://www.softpedia.com/get/System/OS- ... cker.shtml

Its free and simple! The resulting (text) file may be edited using AkelPad, if desired. I believe that the target file should be wscript.exe (Windows\system32 folder under XP).

Posted: Mon Jul 16, 2012 4:03 pm
by FeyFre
KDJ, I think it will be enough to name it as filename itself(i.e wscript.exe). You can prepend it with vendor name.

Posted: Mon Jul 16, 2012 7:35 pm
by KDJ
Thank you Gentlemen.
The program which Surveyor gave, generated this file:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
  version="1.0.0.0"
  processorArchitecture="X86"
  name="CompanyName.ProductName.YourApp"
  type="win32"
/>
<description>Your application description here.</description>
<dependency>
  <dependentAssembly>
  <assemblyIdentity
    type="win32"
    name="Microsoft.Windows.Common-Controls"
    version="6.0.0.0"
    processorArchitecture="X86"
    publicKeyToken="6595b64144ccf1df"
    language="*"
  />
  </dependentAssembly>
</dependency>
</assembly>
[/color]
It looks like a template. You just need to enter own data - name in assemblyIdentity and description.

Posted: Tue Jul 17, 2012 2:29 pm
by Visitor7
Как лучше определить целое число и вернуть в виде числа?
Пока только так догадался, с кучей излишеств:
if ( (Math.floor(string) == string) && !isNaN(parseInt(string,10)) )
return parseInt(string,10);
Math.floor пустые строки с табуляцией и без переводит в "0", поэтому parseInt проверяю, он на пустые строки дает NaN.

Posted: Tue Jul 17, 2012 3:22 pm
by opk44
Visitor7
Этот код посчитает строку "0000001111.00000" тоже целым числом (1111). По-моему это не вполне корректно. Или так и задумано?

Posted: Tue Jul 17, 2012 4:28 pm
by FeyFre
opk44
Ну "0000001111.00000" собственно математическому определению "целое число" соответствует. Также как и и запись 1.5e+1. Другое дело что физики скажут что "0000001111.00000" означает 0000001111 +/- 0.000005 а у них понятие "целого" в таких случаях уже не пляшет.

Posted: Tue Jul 17, 2012 7:25 pm
by Visitor7
opk44 wrote:код посчитает строку "0000001111.00000"
Я заметил. Мне нужно входные аргументы скрипта ограничить и в каком виде чел умудрится цифры ввести если удастся - не критично. Главное чтобы скрипт понял их правильно.
FeyFre wrote:физики скажут что "0000001111.00000" означает 0000001111 +/- 0.000005
В физике результат может быть 1234.123, а погрешность +/-25.4. А другой - с иной. Потом уже усредняют для красоты, статистики и в зависимости от того какая точность преследуется, ну мол напишем так 1200 +/-100, не соврем.
...
Вопрос снимается, я просто не знал что ((" " + 8 + "")/(2 * " " +2 -"")) == 4 а +" " === 0 ))) Зачем бороться с системой если она и так прекрасно работает. Странный язык. Взять тот же Math.floor, почему он кушает -15.6e2, 0x2F, но не кушает -0x2f и 0743, и нахрена нужно опознавание восьмиричной системы если двоичная была бы нужнее, а ее нет.

Posted: Wed Jul 18, 2012 8:13 am
by opk44
Visitor7 wrote:нахрена нужно опознавание восьмиричной системы если двоичная была бы нужнее, а ее нет.
Так уж и нет? Зачем же так безапелляционно. Сами же себе противоречите. В примере (parseInt(string,10)) Вы принудительно используете основание 10. С тем же успехом могли бы пользоваться ЛЮБОЙ системой счисления от 2 до 36! ;)

parseInt(numString, [radix]), где radix от 2 до 36.
Просто префиксы позволяют обойтись без второго параметра, лишь для трех оснований: 8, 10 и 16.

Пример:
WScript.Echo(parseInt('1111100111',2)); // "Результат" = 999