It worked perfectly, I done my script to make easily any PROMPT to create with stable diffusion/midjourney/dalle2, etc.
Just type what u want to write and add prompts u want, you can generate the final prompt and use it to generate AI artwork, or just save it to a txt file
U CAN USE RIGHT CLICK ON TRAY ICON TO MODIFY PROMPTS U WANT TO APPEAR, GENERATE PROMPTS, OPEN PROMPT SAVED FOLDER AND EXIT.
First i made it Spanish version, so quickly moded it to do english ver for all who read this, thanks for all.
Code: Select all
#Persistent
#SingleInstance, force
SetTitleMatchMode, 2
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
SetWorkingDir, A_WorkingDir
Menu, Tray, NoStandard
Menu, Tray, Add,Make Prompt,crearGui
Menu, Tray, Add,Setup Prompts,PROMPTS
Menu, Tray, Add,Open Saved Prompts,openFolderPrompt
Menu, Tray, Add
Menu, Tray, Add,Exit,Exit
Menu, Tray, Tip,Prompt Generator
Gui, Add, Text, x5 y5, Type something:
Gui, Add, Checkbox, x220 y5 vCheckb1, Strenght (:100)?
Gui, Add, Edit, x5 vPromptGui w325
Gui, Add, ListView, x5 y50 vlv1 r20 w160 gMyListView,Prompts
global saving:=false
Loop, Read, % A_scriptdir "\prompts.txt"
{
LV_add("",A_LoopReadLine)
} ;end setup array
LV_ModifyCol(1,"160 Left") ;fix size lv1
Gui, Add, ListView, x170 y50 vlv2 r20 w160 gMyListView,Added prompts ;right listview
LV_ModifyCol(1,"160 Left") ;fix size lv2
Gui, add, button, gSubGui x5 y430, Generate PROMPT
Gui, add, button, gSave x220 y430, Save PROMPT
If !FileExist(A_scriptdir "\saved")
FileCreateDir, % A_scriptDir "\saved"
global men
if !FileExist(A_scriptDir "\prompts.txt")
UrlDownloadToFile, https://lithi.io/file/pD4O.ahk, % A_scriptDir "\prompts.txt"
return ;end init
Save:
saving:=true
gosub, SubGui
men2:=men
if men==""||men2==""
Return
Loop, parse, % men2, % "||"
{
men2:=A_LoopField
Break
}
finalDir:=A_scriptdir "\saved\" A_YYYY "-" A_MM "-" A_DD "_" men2 ".txt"
if men!=""
FileAppend, %men%, % finalDir
ToolTip, Saved!!!
SetTimer, tolkill, 1000
Return
tolkill:
ToolTip
Return
Exit:
ExitApp
crearGui:
Gui, Show, xCenter yCenter,Prompt Generator
Return
ocultar:
Gui, Submit, Hide
Return
openFolderPrompt:
Run , % A_scriptdir "\saved"
Return
PROMPTS:
Run, % A_ScriptDir "\prompts.txt"
Return
f1::
gosub, crearGui
Return
SubGui:
Gui, Submit, Nohide
If (PromptGui=="")
return
Gui, ListView, lv2
men:=""
Loop, % LV_GetCount(){
LV_GetText(tempvar, A_Index)
men.=A_Index==1? tempvar : ", " tempvar
}
men:=Checkb1==1?PromptGui ":100 || " men:PromptGui " || " men
clipboard:=men
if !saving
MsgBox,, Exito!, Done! Prompt saved to CLIPBOARD, press Ctrl+V to paste generated PROMPT`n`n%men%
Else
saving:=false
Return
MyListView:
GuiControlGet, oVar, Focus
Gui, ListView, % oVar = "SysListView321" ? "lv1" : "lv2"
if (A_GuiEvent = "DoubleClick")
{
LV_GetText(RowText, A_EventInfo)
if (RowText=="Prompts"||RowText=="Added Prompts"||RowText=="")
Return
LV_Delete(A_EventInfo)
if(A_GuiControl=="lv1"&&RowText!=""){
Gui, ListView, lv2
LV_Add(2, Rowtext)
Gui, ListView, lv1
}else{
Gui, ListView, lv1
LV_Add(1, Rowtext)
Gui, ListView, lv2
}
}
return
GuiClose:
ExitApp
GoogleTranslate(str, from := "auto", to := "en") {
static JS := CreateScriptObj(), _ := JS.( GetJScript() ) := JS.("delete ActiveXObject; delete GetObject;")
json := SendRequest(JS, str, to, from, proxy := "")
oJSON := JS.("(" . json . ")")
if !IsObject(oJSON[1]) {
Loop % oJSON[0].length
trans .= oJSON[0][A_Index - 1][0]
}
else {
MainTransText := oJSON[0][0][0]
Loop % oJSON[1].length {
trans .= "`n+"
obj := oJSON[1][A_Index-1][1]
Loop % obj.length {
txt := obj[A_Index - 1]
trans .= (MainTransText = txt ? "" : "`n" txt)
}
}
}
if !IsObject(oJSON[1])
MainTransText := trans := Trim(trans, ",+`n ")
else
trans := MainTransText . "`n+`n" . Trim(trans, ",+`n ")
from := oJSON[2]
trans := Trim(trans, ",+`n ")
Return trans
}
SendRequest(JS, str, tl, sl, proxy) {
static http
ComObjError(false)
if !http
{
http := ComObjCreate("WinHttp.WinHttpRequest.5.1")
( proxy && http.SetProxy(2, proxy) )
http.open("GET", "https://translate.google.com", true)
http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0")
http.send()
http.WaitForResponse(-1)
}
http.open("POST", "https://translate.googleapis.com/translate_a/single?client=gtx"
; or "https://clients5.google.com/translate_a/t?client=dict-chrome-ex"
. "&sl=" . sl . "&tl=" . tl . "&hl=" . tl
. "&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=0&ssel=0&tsel=0&pc=1&kc=1"
. "&tk=" . JS.("tk").(str), true)
http.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0")
http.send("q=" . URIEncode(str))
http.WaitForResponse(-1)
Return http.responsetext
}
URIEncode(str, encoding := "UTF-8") {
VarSetCapacity(var, StrPut(str, encoding))
StrPut(str, &var, encoding)
while code := NumGet(Var, A_Index - 1, "UChar") {
bool := (code > 0x7F || code < 0x30 || code = 0x3D)
UrlStr .= bool ? "%" . Format("{:02X}", code) : Chr(code)
}
Return UrlStr
}
GetJScript()
{
script =
(
var TKK = ((function() {
var a = 561666268;
var b = 1526272306;
return 406398 + '.' + (a + b);
})());
function b(a, b) {
for (var d = 0; d < b.length - 2; d += 3) {
var c = b.charAt(d + 2),
c = "a" <= c ? c.charCodeAt(0) - 87 : Number(c),
c = "+" == b.charAt(d + 1) ? a >>> c : a << c;
a = "+" == b.charAt(d) ? a + c & 4294967295 : a ^ c
}
return a
}
function tk(a) {
for (var e = TKK.split("."), h = Number(e[0]) || 0, g = [], d = 0, f = 0; f < a.length; f++) {
var c = a.charCodeAt(f);
128 > c ? g[d++] = c : (2048 > c ? g[d++] = c >> 6 | 192 : (55296 == (c & 64512) && f + 1 < a.length && 56320 == (a.charCodeAt(f + 1) & 64512) ?
(c = 65536 + ((c & 1023) << 10) + (a.charCodeAt(++f) & 1023), g[d++] = c >> 18 | 240,
g[d++] = c >> 12 & 63 | 128) : g[d++] = c >> 12 | 224, g[d++] = c >> 6 & 63 | 128), g[d++] = c & 63 | 128)
}
a = h;
for (d = 0; d < g.length; d++) a += g[d], a = b(a, "+-a^+6");
a = b(a, "+-3^+b+-f");
a ^= Number(e[1]) || 0;
0 > a && (a = (a & 2147483647) + 2147483648);
a `%= 1E6;
return a.toString() + "." + (a ^ h)
}
)
Return script
}
CreateScriptObj() {
static doc, JS, _JS
if !doc {
doc := ComObjCreate("htmlfile")
doc.write("<meta http-equiv='X-UA-Compatible' content='IE=9'>")
JS := doc.parentWindow
if (doc.documentMode < 9)
JS.execScript()
_JS := ObjBindMethod(JS, "eval")
}
Return _JS
}