- Sooyke
- Posts : 250
Join date : 2018-04-28
skinner utility
on Wed Dec 09, 2020 9:00 am

Using skinner i wanted some easy commands:
set ssk : will create a new sticky with the latest ssk file created
unzip ssk : unzip the ssk no need for changing the extension to zip
open dir : explorer window opens ...stickies\skin directory
clear : removes all ini , bmp , png files from the skin directory !!!
to show debug mode to see commands send to stickies.exe run " utility.exe debug "(see image ) , it adds the editcontrol with realtime commands exchange.
Warning for older versions do not put utiliy.exe in stickies directory because "clear" removes ini files and v9 and older versions have a stickies.ini.
- Code:
#noenv
SetTitleMatchMode, slow
DetectHiddenWindows On
SetTitleMatchMode 2
debug:=0
if (A_Args.1 ="debug")
debug:=1
setworkingdir:=a_scriptdir
Gui, +alwaysontop -MinimizeBox -MaximizeBox
if (debug=1)
Gui,add,edit,w170
gui,add,text, , Pause hotkey hide/show
Gui,add,button, w50 h50 gmakenew,set ssk
gui,add,button, w50 h50 yp xp+60 gunzip,unzip ssk
gui,add,button, w50 h50 yp xp+60 gdir,open dir
gui,add,button, w50 h50 yp xp+60 gclear,clear
Gui,show ,,skinner utility
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
TargetScriptTitle = ZhornSoftwareStickiesMain
OnMessage(0x201,"WM_LBUTTONDOWN")
OnMessage(0x4a, "Receive_WM_COPYDATA")
send_("do register",20)
if errorlevel
{
msgbox %errorlevel% in return code is stickies running?
exit
}
return
WM_LBUTTONDOWN(wParam,lParam,msg,hwnd){
PostMessage, 0xA1, 2
}
clear:
FileDelete,%A_ScriptDir%\*.ini
FileDelete,%A_ScriptDir%\*.png
FileDelete,%A_ScriptDir%\*.zip
FileDelete,%A_ScriptDir%\*.bmp
return
dir:
Run,%A_ScriptDir%
return
Pause::
t:=!t
if t
winhide skinner utility
else
winshow skinner utility
return
unzip:
FileSelectFile,sfile,,%A_ScriptDir%,,skin (*.ssk)
SplitPath,sfile,,,,sName
ofile=%A_ScriptDir%\%sName%.zip
FileCopy,%sfile%,%ofile%
sleep 2000
ifnotexist %ofile%
msgbox not found
unz(ofile,A_ScriptDir)
return
list:
Sleep 1000
gui,2:default
Gui,2: Add, ListView, r3 w200 , Name|Size (KB)
Loop, %dZip%\*.*
LV_Add("", A_LoopFileName, A_LoopFileSize)
LV_ModifyCol()
;LV_ModifyCol(2, "Integer")
Gui,2: Show,x100 y100
return
makenew:
ssk_new:=getmostrecent()
msgbox %ssk_new%
stringtosend=do new sticky
send_(stringtosend,20)
sleep 200
WinWaitActive,ASticky
WinGetTitle,title,ASticky
sid:=regexreplace(title,"\D")
stringtosend=set desktop %sid% skinpath %A_ScriptDir%\%ssk_new%
send_(stringtosend,20)
return
getmostrecent(){
Loop,%A_ScriptDir%\*.ssk
{
FileGetTime, Time, %A_LoopFileFullPath%, M
If (Time > Time_Orig)
{
Time_Orig := Time
ssk_new := A_LoopFileName
}
}
return ssk_new
}
Unz(sZip, sUnz)
{
fso := ComObjCreate("Scripting.FileSystemObject")
If Not fso.FolderExists(sUnz) ;http://www.autohotkey.com/forum/viewtopic.php?p=402574
fso.CreateFolder(sUnz)
psh := ComObjCreate("Shell.Application")
psh.Namespace( sZip ).items().count
psh.Namespace( sUnz ).CopyHere( psh.Namespace( sZip ).items, 4|16 )
}
GuiClose:
stringtosend=do deregister
send_(stringtosend,20)
sleep 500
exitapp
Receive_WM_COPYDATA(wParam, lParam)
{
Global sid ,edit1
ID := NumGet(lParam + 0)
len := NumGet(lParam + A_PtrSize)
StringAddress := NumGet(lParam + 2*A_PtrSize)
VarSetCapacity(CopyOfData, len,0)
CopyOfData:= StrGet(StringAddress,len,"cp0")
ControlSetText,edit1,%CopyOfData%,skinner utility
ifinstring,CopyOfData,will send
SoundBeep
return true
}
Send_(StringToSend,IDc)
{
global TargetScriptTitle
DetectHiddenWindows On
SetTitleMatchMode 2
VarSetCapacity(CopyDataStruct, 3*A_PtrSize, 0)
StringToSend=api %StringToSend%
len := StrPutVar(StringToSend, StringToSend, "cp0")+1
NumPut(IDc , CopyDataStruct, 0)
NumPut(len , CopyDataStruct, 4)
NumPut(&StringToSend, CopyDataStruct, 8)
SendMessage, 0x4a, %A_ScriptHwnd%, &CopyDataStruct,, %TargetScriptTitle%
if (errorlevel="fail")
{
MsgBox SendMessage failed. Does the target application runs?
}
return
}
StrPutVar(string, ByRef var, encoding)
{
VarSetCapacity(var, StrPut(string, encoding) * ((encoding="UTF-16"||encoding="CP1200") ? 2 : 1))
return StrPut(string, &var, encoding)
}
Permissions in this forum:
You can reply to topics in this forum
|
|