Jump to content

Michel Claveau

Active Members
  • Posts

    348
  • Joined

  • Last visited

Everything posted by Michel Claveau

  1. Hi, JamesB! You are, perhaps, right. But, I did not read wire on Web-autoit...
  2. Hi! A URL-protocol (like mailto: callto: ftp: http: ), but who launch a command-line. 1): compile this script, like argraw.exe ; then copy it in C:\ #NoTrayIcon $arg=$CmdLineRaw msgbox(0,"$CmdLineRaw",$arg, 20) Exit 2): launch this script (installation-script): $name="autoit" $command="C:\argraw.exe" $tkey="HKEY_CLASSES_ROOT\"&$name RegWrite($tkey) sleep(10) RegWrite($tkey,"","REG_SZ","URL: "&$name&" protocol") sleep(10) RegWrite($tkey,"URL Protocol","REG_SZ","") sleep(10) RegWrite($tkey&"\shell") sleep(10) RegWrite($tkey&"\shell\open") sleep(10) RegWrite($tkey&"\shell\open\command") sleep(10) RegWrite($tkey&"\shell\open\command","","REG_SZ",'"'&$command&'" %1') sleep(10) MsgBox(0,"Terminé","AutoIt protocol ready.",2) Exit 3): Define a HTML page, which contain this line: <a href='autoit: AAA bbb "CCC ddd eee" fff'>AutoIt_Protocol_Link</a> 4): Launch this HTML page (file) into Internet-Explorer ; then click on the link. Conclusion: you can, now, launch command-line (AutoIt or other) from HTML page (local or on-line). It is only necessary to launch once the script of (for?) installation. *** sorry for my bad english ***
  3. Hi! This release, without the StringFormat: $x="MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)" MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x) Variante: $g=chr(34) $x="MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x)" MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x) _
  4. Hi! (ter) I experimented also the schtasks way (create a new task, under another account + run the task + delete the task). Contrainsts are similary (but not identical) to services (sc.exe)
  5. Hi! (bis) > #requireadmin Attn: if UAC is on, "#requireadmin" will raise a question, with impossibility of automating the answer. Another thing: I experimented, also, a different way. Create a service (sc.exe) with a different account + launch this service + delete the service. (On XP, it's OK ; on Vista, with then account "SYSTEM", this run in the "SYSTEM console". And it's... odd). But the UAC cannot be circumvented. On Vista with UAC on, I no have found any way, for launch a file/program with elevated privileges (Aïe, my english!) without manually intervention.
  6. Hi! Under Vista, it's OK (possible) only if UAC is OFF.
  7. Hi, all! With the nice idea from Nemcija, I coded my version of Clap-control. For detect a Clap, the soft search a high level, then the soft wait a low level. And, the compiled version accept three arguments, for launch three differents commands (for 1, 2 r 3 claps). More than 3 close the soft. Sorry for my bad english, and thanks to Nemcija #Include <string.au3> $cde1="" $cde2="" $cde3="" if $CmdLine[0]>0 then $cde1=$CmdLine[1] endif if $CmdLine[0]>1 then $cde2=$CmdLine[2] endif if $CmdLine[0]>2 then $cde3=$CmdLine[3] endif $VoiceActivationLevel = 40 $level=0 Func _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, $hwndCallback) Return DllCall("winmm.dll", "long", "mciSendStringA", "str", $lpszCommand, "str", $lpszReturnString, "long", $cchReturn, "long", 0) EndFunc Func _mciShowError($mciError,$add = "test") Dim $errStr $errStr = _StringRepeat(" ", 256) $Result = DllCall("winmm.dll", "long", "mciGetErrorStringA", "long", $mciError, "string", $errStr, "long", StringLen($errStr)) MsgBox(0, "MCI "&$add, "MCI Error Number " & $mciError & ":" & $Result[2]) EndFunc Func ClapCheck() Global $lpszCommand,$lpszReturnString,$cchReturn,$level $level=0 $mciError = _mciSendString("status tempwave level", $lpszReturnString, $cchReturn, 0) If $mciError[0]<>0 Then MsgBox(0,"Erreur MCI 37; ",$mciError[0]) EndIf If $mciError[2]>0 Then $level=$mciError[2] EndIf If $level >= $VoiceActivationLevel Then $retombe=$level While $retombe >= $VoiceActivationLevel $mciError = _mciSendString("status tempwave level", $lpszReturnString, $cchReturn, 0) $retombe = $mciError[2] sleep(6) WEnd EndIf EndFunc $lpszReturnString = _StringRepeat(" ", 256) $cchReturn = StringLen($lpszReturnString) $mciError = _mciSendString("open new type waveaudio alias tempwave", $lpszReturnString, $cchReturn, 0); If $mciError[0] <> 0 Then _mciShowError($mciError[0],"Startup Error") Exit EndIf $interv=20 $delaimaxientre2clics = Int(600/$interv) ; en millisecondes $ClapCount = 0 $i=$delaimaxientre2clics Global $level $level=0 While 1 Sleep($interv) $i-=1 If $i<=0 Then If $ClapCount>0 Then If $ClapCount=1 Then If $cde1<>"" Then ;Run(@ComSpec & " /c " & $cde1, "", @SW_HIDE) Run(@ComSpec & ' /cstart "" ' & $cde1, "", @SW_HIDE) Else MsgBox(0,"Nb Claps",$ClapCount,1) EndIf EndIf If $ClapCount=2 Then If $cde2<>"" Then Run(@ComSpec & ' /cstart "" ' & $cde2, "", @SW_HIDE) Else MsgBox(0,"Nb Claps",$ClapCount,1) EndIf EndIf If $ClapCount=3 Then If $cde3<>"" Then Run(@ComSpec & ' /cstart "" ' & $cde3, "", @SW_HIDE) Else MsgBox(0,"Nb Claps",$ClapCount,1) EndIf EndIf If $ClapCount>3 Then MsgBox(0,"Nb Claps",$ClapCount,1) EndIf ;ToolTip($ClapCount,180,180,"Nb Claps comptés",0) If $ClapCount>3 Then MsgBox(0,"plus de 3 Claps","Fin du programme",2) ExitLoop EndIf EndIf $i=$delaimaxientre2clics $ClapCount=0 EndIf $level=0 ClapCheck() If $level >= $VoiceActivationLevel Then $ClapCount +=1 $i=$delaimaxientre2clics ;ToolTip($ClapCount & " " & $level & " " & $i,80,80,"Nb Claps",0) EndIf WEnd Exit
  8. Hi! Thanks you, for this good sample/script. One info: for french language, replace the line WinWaitActive("Notepad", "") by WinWaitActive("Bloc-notes", "")
  9. Bonjour ! Voir là : http://www.autoit.fr/
  10. [headroom] Thanks for your thanks [DBak] I don't know, for BD. My (little) utility run OK with Vista (& XP). I found than Vista is great! Many new (ou re-new) commands come with Vista (look a DIR %WINDIR%\system32\*.exe ) @-salutations Michel Claveau
  11. Hi! My english is bad. Read the code! #cs CPanel is able to create an entry in the control panel, targeting one of your exe(s). Usage : - create un new/unique GUID - fill variables - run - go to Control_Panel, for try - send 51000000 $ to Michel Claveau, for thanks... #ce $GUID="{00000000-0000-0000-C000-000000000099}" $localizedstring="MySoft: Configuration-Center" $infotip="The confiiiiiiiiiiiiiig of my soft" $categories="" $appliname="mysoft" ;FileInstall("D:\Dev\autoit\mysoft.ico","C:\mys\",1) $icon="C:\mys\mysoft.ico" $command="C:\mys\mysoft.exe" $tkey="HKEY_CLASSES_ROOT\CLSID\"&$GUID RegWrite($tkey) RegWrite($tkey&"\Shell") RegWrite($tkey&"\Shell\Open") RegWrite($tkey&"\Shell\Open\Command") RegWrite($tkey&"\Shell\Open\Command","","REG_SZ",$command) RegW($tkey,"LocalizedString","REG_EXPAND_SZ",$localizedstring) RegW($tkey,"InfoTip","REG_EXPAND_SZ",$infotip) RegW($tkey,"System.ApplicationName","REG_SZ",$appliname) If $categories<>"" Then RegW($tkey,"System.ControlPanel.Category","REG_SZ",$categories) EndIf RegWrite($tkey&"\DefaultIcon") RegW($tkey&"\DefaultIcon","","REG_EXPAND_SZ",$icon) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\ControlPanel\NameSpace\"&$GUID) Exit Func RegR($clef,$valeur) $v=RegRead($clef,$valeur) #cs If @error Then If @error= 1 Then MsgBox(0,"Erreur", "unable to open requested key ") If @error= 2 Then MsgBox(0,"Erreur", "unable to open requested main key ") If @error= 3 Then MsgBox(0,"Erreur", "unable to remote connect to the registry ") If @error= -1 Then MsgBox(0,"Erreur", "unable to open requested value ") If @error= -2 Then MsgBox(0,"Erreur", "value type not supported ") EndIf #ce Return $v EndFunc Func RegW($clef, $valeur, $typ, $contenu) $v2=RegR($clef,$valeur) If $v2=$contenu Then Return EndIf $v=RegWrite($clef, $valeur, $typ, $contenu) If @error Then If @error= 1 Then MsgBox(0,"Erreur", "unable to open requested key ") If @error= 2 Then MsgBox(0,"Erreur", "unable to open requested main key ") If @error= 3 Then MsgBox(0,"Erreur", "unable to remote connect to the registry ") If @error= -1 Then MsgBox(0,"Erreur", "unable to open requested value ") If @error= -2 Then MsgBox(0,"Erreur", "value type not supported ") EndIf $v2=RegR($clef,$valeur) If $v2<>$contenu Then MsgBox(0,"Problème avec REG",$clef &@CRLF& $valeur &@CRLF& $contenu &" vs "& $v2) EndIf Return $v EndFunc If you prefer, you can replace the .exe by a .bat, or a command-line. Info ; categories possible are (sorry, in french) : 1 - apparence & personnalisation (personnalization) 2 - Matériel & audio (hard & sound) 3 - Réseau & Internet (LAN & Net) 4 - non utilisé 5 - Système (System) 6 - Horloge, Langue (Clock, Language) 7 - Ergonomie 8 - Programmes (softwares) 9 - Utilisateurs (users) 10- Sécurité (sécurity) 11- Mobile Several categories is possible (example : "5,9") ; or anything
  12. Hi! You want short code? Try this: $ip=StringMid(InetGet("http://alexissoft.free.fr/ip.php", "ip_temp.txt")&FileRead("ip_temp.txt"),2)
  13. Hi! From my prior code, I have get a mini-mini binary-clock: Dim $bit[2]=["0","1"] For $x=1 To 60*60*24 sleep(990) ToolTip(nbbin(@HOUR) & nbbin(@MIN) & nbbin(@SEC), 10, 10) Next Func nbbin($nb) $bits = " " For $j = 5 To 0 Step -1 $bits &= $bit[BitAND(Int($nb),2^$j)/2^$j] Next Return $bits & @CRLF EndFunc Only good for understand Autoit... (or like begin of a BigBinaryClock)
  14. Hi, all! Several "externals" defrag tools use the API of Windows, for defrag (for example, JkDefrag). Windows come with defrag.exe (%WINDIR%\system32). It's "standalone exe", little, scriptable (batch / AutoIt / schtasks / etc.), with many good options, and native. Use defrag /? for see (sorry for my approx english)
  15. Hi! I have write this code to spend time, because my wife was late... #include <Array.au3> $ai2 = _ArrayCreate(0,0,0) $ai22 = _ArrayCreate(0,0,0) $buffer=_ArrayCreate("","","") For $x=1 To 60*60*24 Sleep(990) $temps=_ArrayCreate(nbbin(Int(@HOUR)),nbbin(Int(@MIN)),nbbin(Int(@SEC))) ScreenText($temps , 0, 10, 20) Next Func nbbin($nb) $bits = _ArrayCreate("0","0","0","0","0","0") $i=32 For $j=0 To 5 If Int($nb/$i)>0 Then $bits[$j]="1" $nb-=$i EndIf $i=$i/2 Next Return _ArrayToString($bits,"") EndFunc Func ScreenText($txt, $duree, $x,$y) $size=32 $inc=$size*3/4 For $i=0 To 2 If $txt[$i]<>$buffer[$i] Then $buffer[$i]=$txt[$i] $long=Stringlen($txt[$i]) If $ai22[$i]<>0 Then GUIDelete($ai22[$i]) EndIf $ai22[$i] = GUICreate("Text Region",$long*$size,$size,$x+3,$y+2+$inc*$i,$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $rgn22 = CreateTextRgn($ai22[$i],$txt[$i],$size,"Arial Narrow",1000) SetWindowRgn($ai22[$i],$rgn22) GUISetState() If $ai2[$i]<>0 Then GUIDelete($ai2[$i]) EndIf $ai2[$i] = GUICreate("Text Region",$long*$size,$size,$x,$y+$inc*$i,$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GUISetBkColor(0xFFFF00) $rgn2 = CreateTextRgn($ai2[$i],$txt[$i],$size,"Arial Narrow",1000) SetWindowRgn($ai2[$i],$rgn2) GUISetState() EndIf Next EndFunc Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreateTextRgn(ByRef $CTR_hwnd,$CTR_Text,$CTR_height,$CTR_font="Microsoft Sans Serif",$CTR_weight=1000) Local Const $ANSI_CHARSET = 0 Local Const $OUT_CHARACTER_PRECIS = 2 Local Const $CLIP_DEFAULT_PRECIS = 0 Local Const $PROOF_QUALITY = 2 Local Const $FIXED_PITCH = 1 Local Const $RGN_XOR = 3 If $CTR_font = "" Then $CTR_font = "Microsoft Sans Serif" If $CTR_weight = -1 Then $CTR_weight = 1000 Local $gdi_dll = DLLOpen("gdi32.dll") Local $CTR_hDC= DLLCall("user32.dll","int","GetDC","hwnd",$CTR_hwnd) Local $CTR_hMyFont = DLLCall($gdi_dll,"hwnd","CreateFont","int",$CTR_height,"int",0,"int",0,"int",0, _ "int",$CTR_weight,"int",0,"int",0,"int",0,"int",$ANSI_CHARSET,"int",$OUT_CHARACTER_PRECIS, _ "int",$CLIP_DEFAULT_PRECIS,"int",$PROOF_QUALITY,"int",$FIXED_PITCH,"str",$CTR_font ) Local $CTR_hOldFont = DLLCall($gdi_dll,"hwnd","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hMyFont[0]) DLLCall($gdi_dll,"int","BeginPath","int",$CTR_hDC[0]) DLLCall($gdi_dll,"int","TextOut","int",$CTR_hDC[0],"int",0,"int",0,"str",$CTR_Text,"int",StringLen($CTR_Text)) DLLCall($gdi_dll,"int","EndPath","int",$CTR_hDC[0]) Local $CTR_hRgn1 = DLLCall($gdi_dll,"hwnd","PathToRegion","int",$CTR_hDC[0]) Local $CTR_rc = DLLStructCreate("int;int;int;int") DLLCall($gdi_dll,"int","GetRgnBox","hwnd",$CTR_hRgn1[0],"ptr",DllStructGetPtr($CTR_rc)) Local $CTR_hRgn2 = DLLCall($gdi_dll,"hwnd","CreateRectRgnIndirect","ptr",DllStructGetPtr($CTR_rc)) DLLCall($gdi_dll,"int","CombineRgn","hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn1[0],"int",$RGN_XOR) DLLCall($gdi_dll,"int","DeleteObject","hwnd",$CTR_hRgn1[0]) DLLCall("user32.dll","int","ReleaseDC","hwnd",$CTR_hwnd,"int",$CTR_hDC[0]) DLLCall($gdi_dll,"int","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hOldFont[0]) DLLClose($gdi_dll) Return $CTR_hRgn2[0] EndFunc
  16. Hi! Sorry for long time to answer (I'am very very busy...) Sorry, also, for my bad english. Perhaps this next code can be agree by you? $listdir='C:\Temp "C:\Program Files" D:\data "D:\my backups" ' $r=cmdr("cmd /cecho off && FOR %i IN ("& $listdir &") DO dir %i /b /s") MsgBox(0,"Résultat :",$r) Func cmdr($cde) $result="" $pid = Run($cde,"",0,6) While 1 $result &= StdoutRead($pid) If @error Then ExitLoop Wend return $result EndFunc If you can get an array for result, you can split $r. And, with the same function, you can use this code, more readable, but less generic: $r=cmdr('cmd /cdir "C:\Doc\MVP" D:\data "D:\my backups" C:\Temp /b /s') MsgBox(0,"Résultat :",$r)
  17. Hi! A very fast way, for index the content of some directories is... BATCH ! @echo off del index.dat echo BatchIndexed>index.dat FOR %%i IN (%*) DO dir %%i /b /s >>index.dat Save like "index.bat" Usage: index dir1 dir2 dir3 ... Examples: index C:\data\sources index C:\data D:\sauve\data index "C:\Program Files" D:\data "D:\my backups" Try it ; it's very faster!
  18. Hi! I search a way for automatize the owner add/change for a key (and sub-keys) of register. Any idea? Thanks by advance.
  19. Hi! Little problem: NET SEND no longer exist in Vista... Good luck, for found other thing. (edit: on Vista, you must use then command MSG ; try MSG /?)
  20. Hi! Your process_list (with WMI) eat 50% of processor but Processlist() (AutoIt function) need only 8% of processor...
  21. Well... Well... And, for dynamic delete? How-to?
  22. Hi! Disable UAC. And work like local admin.
  23. Hi! Thanks for info. I will try on XP soon.
×
×
  • Create New...