Knowledge micro: IF extended by pull up

Last night I thought of a question about how to avoid multiple requests when the pull up action is triggered many times when the page is pulled up. So it came true.

 Let i=0
if (i==0) 
up

It is found that multiple pull ups can be solved. It seems to be solved, but there is a conditional competition in the if judgment sentence. Therefore, one reason is that there is no conditional competition because of the logic problem of JavaScript compilation and execution. So I used C++ to rewrite a similar one.

 #include "windows.h" 
int I = 0; 
DWORD WINAPI ThreadProc2 (LPVOID lpParam) 
{
Sleep (300); 
printf ("3")); (= = 0; 0); (0); "(" = = 0 ") =" 1 ";" ("0")); "(", "0", ",", "0"); "(" 1 ");;

So you will find that it still solves the problem of pull up very well. Because the compiled opcode of C++ is close to the machine code, the compilation and execution problem of JavaScript does not exist. But it still does not print "0" many times. Many forgery is done through threads. Let me think of Cpu's question. Cpu slice and thread execution. From the code point of view, it has competition problems, but the sum of some external factors evade the problem. There is no answer, why do we evade the race problem?

Novel renewal

 Gh_11d136296ec9_258.jpg

After consulting the novel, click Update. Representatives with red badges are updated.

Assistor PS analysis

 WeChat screenshot _20190806163246.png

Assistor PS:Save Your Valuable Time (save your precious time)

First look Assistor PS makes me feel amazing. It doesn't need to exist in the form of plug-ins, it can read layers, and annotate, cut, distance calculation and so on a series of black technology functions for each layer. So Anne couldn't help analyzing it.

 WeChat screenshot _20190806163744.png

The interface is very beautiful, and then there are a few buttons, originally wanted to directly find the button under the event, found not too easy to find, so changed a train of thought, find the hotkey corresponding events.

Decompile the following code

 GlobalHotKey.Register (hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D1).Pressed = OnHotKeyPressed; 
GlobalHotKey.Register (hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D2) = =.Pressed; = (f);

Then find the callback event.

 Switch (e.Key) 
{
default:
return; 
case GlobalHotKey.Keys.D1:
Tool.ExecutePosition (); 
break; 
case GlobalHotKey.Keys.D2:
Tool.ExecuteSize (;); 
break; 
case GlobalHotKey.Keys.D3:
Tool.ExecuteDistance (); 
break;; (E);; (E); "("); ";"; "("); "("); "

It is found that the author encapsulates some operations to view the Tool class.

 Public void ExecutePosition () 
{
this.AppendLog (LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_Position, string.Empty, string.Empty); 
this. (ScriptProvider.Execute (string.Empty, V ())); (2), (1), ((1), (2), (1), ((2), (1), ((), ()); (2), (1, (2), (2), ((), (), ((), ()); (2); ( IstorLogType.LayerDescriptor_GuideBox, string.Empty, string.Empty); 
this. (ScriptProvider.Execute (ScriptMethodType.GuideBox, this. ())); 
}
public void ExecuteSnips () 
{
this.AppendLog (ExecuteSnips, x, P, R, d); (((x), ());}

Then there is a ScriptProvider, which contains some relatively good writing processes. In general, you can judge the type of your execution by ScriptMethodType, and then execute the JSX script of Photoshop.

ScriptMethodType type

 Public enum ScriptMethodType
{
Position, 
Size, 
Text, 
Distance, 
GuideBox, 
Snips, 
Description, 
Document, 
Guides, 
GuidesHCenter,

JSX script

  1. JSX.WIT.Photoshop.Application.jsx

  2. JSX.WIT.Photoshop.Common.jsx

  3. JSX.WIT.Photoshop.Document.jsx

  4. JSX.WIT.Photoshop.DrawingContext.jsx

  5. JSX.WIT.Photoshop.JSON.jsx

  6. JSX.WIT.Photoshop.Parameter.jsx

  7. JSX.WIT.Photoshop.Parser.jsx

  8. JSX.WIT.Photoshop.Polygons.jsx

  9. JSX.WIT.Photoshop.Processor.jsx

  10. JSX.WIT.Photoshop.Script.Capture.jsx

  11. JSX.WIT.Photoshop.Script.Distance.jsx

  12. JSX.WIT.Photoshop.Script.Export.jsx

  13. JSX.WIT.Photoshop.Script.GuideBox.jsx

  14. JSX.WIT.Photoshop.Script.Guides.jsx

  15. JSX.WIT.Photoshop.Script.GuidesClear.jsx

  16. JSX.WIT.Photoshop.Script.GuidesHCenter.jsx

  17. JSX.WIT.Photoshop.Script.GuidesVCenter.jsx

  18. JSX.WIT.Photoshop.Script.jsx

  19. JSX.WIT.Photoshop.Script.Position.jsx

  20. JSX.WIT.Photoshop.Script.Rounder.jsx

  21. JSX.WIT.Photoshop.Script.Size.jsx

  22. JSX.WIT.Photoshop.Script.Snips.jsx

  23. JSX.WIT.Photoshop.Script.Text.jsx

  24. JSX.WIT.Photoshop.Script.Tiler.jsx

You can see that the name is consistent with the ScriptMethodType custom type.

Part script source code

 function Photoshop() {
    
    
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putProperty(typeID("Prpr"), typeID("PbkO"));
    ref.putEnumerated(typeID("capp"), typeID("Ordn"), typeID("Trgt"));
    desc.putReference(typeID("null"), ref );
    
    var pdesc = new ActionDescriptor();
    pdesc.putEnumerated(typeID("performance"), typeID("performance"), typeID("accelerated"));    
    desc.putObject(typeID("T   "), typeID("PbkO"), pdesc );
    executeAction(typeID("setd"), desc, DialogModes.NO);
    
}
Photoshop.prototype.SetPanelVisibility = function(panelName, visible)
{
    try {
        var desc = new ActionDescriptor();
        var ref = new ActionReference(); 
        ref.putName( stringIDToTypeID( "classPanel" ), panelName ); 
        desc.putReference( charIDToTypeID( "null" ), ref ); 
        executeAction( stringIDToTypeID( visible ? "show" : "hide"), desc, DialogModes.NO );  
    }
    catch(ex)
    {
    }
        
 
}
Photoshop.prototype.SetLayersPanelVisibil 
}
Photoshop.prototype.GetActiveDocument = function (()) {
return new Document ({
return, new ());} (} (}); (2) = (()) (=); ("(") ");" ("" ")"; "(" "")); "(" "") ";" ("" ")" ("(")), "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" "")), "(" "")), "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(") "ity = function (visible) 
{
this.SetPanelVisibility ('panelid.static.layers', visible); Nce.putIdentifier (typeID ("Dcmn"), documentId); 
documentDescriptor.putReference (typeID ("null"), documentReference); 
executeAction (typeID ("SLCT"), 
executeAction);}; {} = (());}; {}; (=); (=); {};};