小编And*_*rew的帖子

Photoshop 批量应用“最后一个滤镜”适用于除液化之外的所有滤镜

此脚本采用最后应用的过滤器并在所有选定的图层和蒙版上重复该过滤器。(它旨在避免将图层折叠到智能对象中以便批量应用过滤器的需要)。

但是,其中有一个我无法弄清楚的错误:它对于高斯模糊之类的东西效果很好,但是对于液化,它会在历史记录中记录应用了过滤器,但图层保持不变。

重现步骤:1.模糊图层 1。2.选择图层 2(蒙版)和 3(未蒙版)3.运行脚本4.重复 1-3,但使用液化而不是模糊。

#target photoshop 

var defaultRulerUnits = preferences.rulerUnits; preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument; 
var layers = doc.layers;
var typeArray = new Array ();
var isim = new Array();


cTID = function(s) { return app.charIDToTypeID(s); }; sTID = function(s) { return app.stringIDToTypeID(s); };

function repeatlastfilter() {
    runMenuItem(cTID("LstF"), true);
}  

function checklayermask() {
    try {
        Select_Layermask();
    }
    catch (err) { return }
    repeatlastfilter();
    Select_Original_Layer();       
    }

// MAIN …
Run Code Online (Sandbox Code Playgroud)

javascript photoshop extendscript photoshop-script photoshop-sdk

8
推荐指数
0
解决办法
251
查看次数

HTML 头中的两个脚本冲突(Brython 和 iFlyChat)

我正在加载 Brython 和 iFlyChat,但如果取消注释 iFlyChat 脚本,Brython 将无法工作。我尝试了各种异步组合,但似乎有一些更基本的东西。

JSFiddle在这里和下面的代码:

https://jsfiddle.net/tutmoses/c09dhbrq/

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>

<!-- BRYTHON -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.8/brython.js" integrity="sha256-rA89wPrTJJQFWJaZveKW8jpdmC3t5F9rRkPyBjz8G04=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.8/brython_stdlib.js" integrity="sha256-Gnrw9tIjrsXcZSCh/wos5Jrpn0bNVNFJuNJI9d71TDs=" crossorigin="anonymous"></script>

<!-- IFLYCHAT 
<script>
console.log("init iflychat plugin");
var iflychat_app_id="1c0d1abc-4864-4608-acb7-6cdbfab07ce2";
var iflychat_external_cdn_host="cdn.iflychat.com",iflychat_bundle=document.createElement("SCRIPT");iflychat_bundle.src="//"+iflychat_external_cdn_host+"/js/iflychat-v2.min.js?app_id="+iflychat_app_id,iflychat_bundle.async="async",document.body.appendChild(iflychat_bundle);var iflychat_popup=document.createElement("DIV");iflychat_popup.className="iflychat-popup",document.body.appendChild(iflychat_popup);
</script> -->

</head>
<body onload="brython()">

  <div class="container">

    <h2 id="hello"></h2>
    <button id="alert-btn">Alert & Insert</button>

    <input type="text" id="text" placeholder="Enter something">
    <span id="output"></span>

</div>
<!-- Alert & DOM insert -->
<script type="text/python" id="script0">
    from browser import document, console, alert

    def show(e):
        console.log(e) …
Run Code Online (Sandbox Code Playgroud)

javascript brython

6
推荐指数
1
解决办法
142
查看次数

运行时警告:从未等待协程 'qr.&lt;locals&gt;.confirm'

我正在用 Flask 编写一个 webapp。在我的一条路线中,我有一个函数可以侦听 API 并等待注册付款。该函数被调用confirm()。我将它传入render_templateasconfirm=confirm并使用 Jinja2 在页面上调用它:{{ confirm(cost) }}

我已经意识到需要异步调用该函数,否则页面在付款之前不会加载。但是,我收到了需要等待该函数的名义错误。阅读后,我尝试将路线更改为,async def qr()但 Flask 不会加载它,所以我不确定await在这种情况下应该如何使用。

async def confirm(cost):
        json = { "action": "account_history", "account": app.config['NANO'], "count": 5, "raw": False, "reverse": False }
        now = datetime.now()
        delta = timedelta(seconds=60)
        while datetime.now() < now+delta:
            test = requests.post("https://nanoverse.io/api/node",json=json).json()
            for item in test["history"]:
                if item["amount"] == cost:
                    flash("Payment Received!")
                    break
            else:
                continue
            break
Run Code Online (Sandbox Code Playgroud)

python jinja2 flask async-await

5
推荐指数
1
解决办法
185
查看次数