• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do I hide this blinking window

Explorer ,
May 22, 2023 May 22, 2023

Copy link to clipboard

Copied

system('start /min reg add "HKEY_CURRENT_USER\\Software\\abcdefg" /f')

 

When this code runs, the window flashes

20230522214609.png

 

TOPICS
Actions and scripting

Views

398

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , May 22, 2023 May 22, 2023
var ret  = run_cmd('reg add "HKEY_CURRENT_USER\\Software\\abcdefg" /f', false, false);

alert(ret);

/////////////////////////////////////////////////
function run_cmd(cmd, visible, wait)
    {
    try {
        var tmp_name = "tmp.js";

        var file = new File(Folder.temp.fsName + "\\" + tmp_name);
        file.open("w");
        file.encoding = "UNICODE-1-1-UTF-8";

        if (file.error) throw(file.error);

        file.writeln("WScript.CreateObject(\"WScript.Shell\").Run(" + cmd.toSourc
...

Votes

Translate

Translate
Adobe
Community Expert ,
May 22, 2023 May 22, 2023

Copy link to clipboard

Copied

what exactly are your trying to do?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 22, 2023 May 22, 2023

Copy link to clipboard

Copied

I want to write to the registry and use this line of code to write to the registry when there is an error in the script 

system('start /min reg add "HKEY_CURRENT_USER\\Software\\abcdefg" /f')

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 22, 2023 May 22, 2023

Copy link to clipboard

Copied

what are you trying to write something to the registry?

 

why are you trying to write something to the registry?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 22, 2023 May 22, 2023

Copy link to clipboard

Copied

The line of code I sent can be written to the registry, but a flashing console window appears, and I want to be able to hide this window from running 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 22, 2023 May 22, 2023

Copy link to clipboard

Copied

LATEST
var ret  = run_cmd('reg add "HKEY_CURRENT_USER\\Software\\abcdefg" /f', false, false);

alert(ret);

/////////////////////////////////////////////////
function run_cmd(cmd, visible, wait)
    {
    try {
        var tmp_name = "tmp.js";

        var file = new File(Folder.temp.fsName + "\\" + tmp_name);
        file.open("w");
        file.encoding = "UNICODE-1-1-UTF-8";

        if (file.error) throw(file.error);

        file.writeln("WScript.CreateObject(\"WScript.Shell\").Run(" + cmd.toSource() + "," + (visible?"1":"0") + "," + (wait?"true":"false") + ");");

        file.writeln("with(new ActiveXObject(\"Scripting.FileSystemObject\")) GetFile(GetSpecialFolder(2).Path+\"\\\\\"+\"" + tmp_name + "\").Delete();");  

        if (file.error) throw(file.error);

        file.close();
        file.execute();

        var ok = false;
    
        try {
            while (1)
                {
                if (!file.exists) { ok = true; break; }

                set_performance("stepByStep");
                }   
            }
        catch(e) { }

        set_performance("accelerated");

        return ok;
        }
    catch(e) { alert(e); }
    }

/////////////////////////////////////////////////
function set_performance(mode)
    {
    try {
        var d = new ActionDescriptor();
        var r = new ActionReference();
        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("playbackOptions"));
        r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
        d.putReference(stringIDToTypeID("null"), r);
        var d1 = new ActionDescriptor();
        d1.putEnumerated(stringIDToTypeID("performance"), stringIDToTypeID("performance"), stringIDToTypeID(mode));
        d.putObject(stringIDToTypeID("to"), stringIDToTypeID("playbackOptions"), d1);
        executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
        }
    catch (e) { throw(e); }
    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines