AutoHotkey Community

It is currently May 26th, 2012, 12:37 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 166 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11, 12  Next
Author Message
 Post subject:
PostPosted: November 17th, 2008, 7:42 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
It is good for associative arrays. The problem is not random collisions, but finding strings with the same hash is not very difficult, if you know the algorithm. I am not sure, how hard it is, because MSDN does not tell the algorithm.

For longer (<=7 bytes) hash you could try
Code:
Hash(Str, L=4, nSz=0) {
  Static HashData
  If (HashData="")
      HashData := DllCall("GetProcAddress", UInt,DllCall("LoadLibrary", Str,"shlwapi.dll"), Str,"HashData")
  DllCall(HashData, UInt,&Str, UInt,nSz<1 ? StrLen(Str):nSz, Int64P,Hash, UInt,8)
  FI := A_FormatInteger
  SetFormat Integer, H
  Hash := SubStr(Hash+0x100000000000000,1-2*L)
  StringUpper Hash, Hash
  SetFormat Integer, %FI%
  Return Hash
}
It computes 8 bytes hash even when less than 8 bytes are requested, and discards the unused part. A general solution was VarsetCapacity and Str type for the returned value, and convert the result to hex with a loop.

Sprintf handles the padding and hex conversion for up to 8 Bytes input, so the following code is better, little shorter, and could be faster
Code:
Hash(Str, L=4, nSz=0) { ; L Bytes, 2*L HEX digits output, 1<=L<=8
  Static HashData, sprintf, S=1234567890123456
  If (HashData="")
      HashData := DllCall("GetProcAddress", UInt,DllCall("LoadLibrary", Str,"shlwapi.dll"),Str,"HashData")
      ,sprintf := DllCall("GetProcAddress", UInt,DllCall("LoadLibrary", Str,"msvcrt.dll"), Str,"sprintf")
  DllCall(HashData, UInt,&Str, UInt,nSz<1 ? StrLen(Str):nSz, Int64P,Hash, UInt,8) ; 8-Byte= 64-bit hash
  DllCall(sprintf, Str,S, Str,"%016I64X", Int64,Hash) ; 0-padded (left), 16 HEX digits
  Return SubStr(S, 1-2*L) ; only 2L digits
}


Edit 20081120: shorter code added


Last edited by Laszlo on November 20th, 2008, 5:45 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2008, 12:06 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Laszlo wrote:
It is good for associative arrays.


Glad to hear it..

Code:
DllCall(HashData, UInt,&Str, UInt,nSz<1 ? StrLen(Str):nSz, Int64P,Hash, UInt,8)


I missed that part :shock: .. Thank you.

Laszlo wrote:
It computes 8 bytes hash even when less than 8 bytes are requested, and discards the unused part. A general solution was VarsetCapacity and Str type for the returned value, and convert the result to hex with a loop.


Thank you very much Sir. Very useful info for me.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: HashData()
PostPosted: November 20th, 2008, 8:55 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
ProcessOwner()

Returns the Owner for a given Process ID. To make it fully functional, one needs to call SetDebugPrivilege() prior to ProcessOwner()


Code:
ProcessOwner( PID ) {
 ; PROCESS_QUERY_INFORMATION=0x400, TOKEN_READ:=0x20008 , TokenUser:=0x1
 hProcess := DllCall( "OpenProcess", UInt,0x400,Int,0,UInt,PID )
 DllCall( "Advapi32.dll\OpenProcessToken", UInt,hProcess, UInt,0x20008, UIntP,Tok )
 DllCall( "Advapi32.dll\GetTokenInformation", UInt,Tok, UInt,0x1, Int,0, Int,0, UIntP,RL )
 VarSetCapacity( TI,RL,0 )
 DllCall( "Advapi32.dll\GetTokenInformation"
          , UInt,Tok, UInt,0x1, UInt,&TI, Int,RL, UIntP,RL ),           pSid := NumGet(TI)
 DllCall( "CloseHandle", UInt,hProcess ), DllCall( "CloseHandle", UInt,Tok )
 ; following code taken from www.autohotkey.com/forum/viewtopic.php?p=116487 - Author Sean
 DllCall( "Advapi32\LookupAccountSidA"
         , Str,"", UInt,pSid, UInt,0, UIntP,nSizeNM, UInt,0, UIntP,nSizeRD, UIntP,eUser )
 VarSetCapacity( sName,nSizeNM,0 ), VarSetCapacity( sRDmn,nSizeRD,0 )
 DllCall( "Advapi32\LookupAccountSidA"
    , Str,"", UInt,pSid, Str,sName, UIntP,nSizeNM, Str,sRDmn, UIntP,nSizeRD, UIntP,eUser )
 DllCall( "LocalFree", UInt,pSid )
Return sName


; usage example follows

; SetDebugPrivilege() ; www.autohotkey.com/forum/viewtopic.php?p=232199#232199
Process Exist, svchost.exe
PID := ErrorLevel
MsgBox, % ProcessOwner( PID )


:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2008, 1:23 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Very nice. This is another one which surprised me at that it's not been done earlier.
BTW, as the first ones which attract my eyes are the flags as they are in red, I'd like to mention that TOKEN_QUERY ( :=8 ) is enough in place of TOKEN_READ although it's cosmetic one.
And one request: it may depend on an user, but I'd always like to include (referenced) domain name too like:
Code:
sRDmn . "\" . sName


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2008, 5:08 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Sean wrote:
Very nice. This is another one which surprised me at that it's not been done earlier.


Many thanks for your help Sean. :)

Quote:
TOKEN_QUERY ( :=8 ) is enough in place of TOKEN_READ although it's cosmetic one.


I was wondering about it.. just adapted it : http://nibuthomas.wordpress.com/2008/01 ... a-process/

Quote:
And one request: it may depend on an user, but I'd always like to include (referenced) domain name too


Honestly, I did not notice it at all. I took your code for granted and all I did was to remove quote around Arg Types. . :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: ColorAdjL()
PostPosted: December 17th, 2008, 5:48 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
ColorAdjL()

Adjust Luminance for a given RGB color. In other words, this function can derive a lighter / darker shade for a given RGB color

Parameters.

Luminance : Value between 1 - 239 ( 0 is black and 240 is White )
RGB : The RGB color to be adjusted. If ignored, a random color will be generated and used

Usage Examples:
Code:
; To derive a dark / light shade of red
darkRed := ColorAdjL(  70, 0xFF0000 )
liteRed := ColorAdjL( 235, 0xFF0000 )

Code:
; To derive a random ( but matching ) dark / light shade
darkRandom := ColorAdjL(  70 )
liteRandom := ColorAdjL( 235, "0x" darkRandom )


Code:
ColorAdjL( Lum=235, RGB="" ) {
 IfEqual,RGB,, Random,RGB,1,16777215
 DllCall( "shlwapi\ColorRGBToHLS", UInt,RGB, UIntP,H, UIntP,L, UIntP,S )
 CC := DllCall( "shlwapi\ColorHLSToRGB", UInt,H, UInt,Lum, UInt,S )
 VarSetCapacity(RGB,6,0), DllCall( "msvcrt.dll\sprintf", Str,RGB, Str,"%06X", UInt,CC )
Return RGB
}

Gui +ToolWindow +AlwaysOnTop
Dark  := ColorAdjL(  70, 0xFF0000 )
Light := ColorAdjL( 235, 0xFF0000 )
Gui, Color, %Light%
Gui, Font, s50
Gui, Add, Text, x5 y5 w200 h75 c%Dark% Center vText, Hello
Gui, Font
Gui, Add, Edit, x36 y100 w30 h20 Limit3 Center vLum, 230
Gui, Add, Button, x+5 h20 w100 gChangeGuiColor, Random Color
Gui, Show, w210 h130, % " GuiColor : " Light
Return

ChangeGuiColor:
 GuiControlGet, Lum
 Light := ColorAdjL( Lum )
 Gui, Color, %Light%
 Gui, Show,, % " GuiColor : " Light
Return

GuiClose:
 ExitApp



:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: SoundExClassic()
PostPosted: December 28th, 2008, 1:48 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
SoundExC() - SoundEx Classic Version

Quote:
http://en.wikipedia.org/wiki/Soundex

Soundex is a phonetic algorithm for indexing names by sound, as pronounced in English. The goal is for names with the same pronunciation to be encoded to the same representation so that they can be matched despite minor differences in spelling. Soundex is the most widely known of all phonetic algorithms and is often used (incorrectly) as a synonym for "phonetic algorithm". Improvements to Soundex are the basis for many modern phonetic algorithms


Quote:
How To: Understanding Classic SoundEx Algorithms

The Algorithm as an Outline
  • Capitalize all letters in the word and drop all punctuation marks. Pad the word with rightmost blanks as needed during each procedure step.
  • Retain the first letter of the word.
  • Change all occurrence of the following letters to '0' (zero):
    'A', E', 'I', 'O', 'U', 'H', 'W', 'Y'.
  • Change letters from the following sets into the digit given:
    1 = 'B', 'F', 'P', 'V'
    2 = 'C', 'G', 'J', 'K', 'Q', 'S', 'X', 'Z'
    3 = 'D','T'
    4 = 'L'
    5 = 'M','N'
    6 = 'R'
  • Remove all pairs of digits which occur beside each other from the string that resulted after step (4).
  • Remove all zeros from the string that results from step 5.0 (placed there in step 3)
  • Pad the string that resulted from step (6) with trailing zeros and return only the first four positions, which will be of the form <uppercase letter> <digit> <digit> <digit>.
The algorithm presented above is slightly improved over the originally patented algorithm.
The original Soundex algorithm of 1918 starts to fail when the number of words in the database gets to be large. For example, the diversity of names in a large database with many foreign spellings starts to put more and more phonetically unlike names into the same code.

The slightly improved algorithm presented here differs from the original in step three, where the vowel sounds are replaced with zeros ('0'), and in step (6.0) where those zeros are removed. The original algorithm eliminated the vowels completely in step 3.0, before duplicate adjacent digits are removed.

This improved version will produce SoundEx codes with duplicate digits in them; for example, "HERMAN" will code to "H06505" which will then reduce to "H655" in the last step. In the original version, "HERMAN" would code to "H655" which will then reduce to "H65" and finally to "H650" in the last step.


Code:
SoundExC( Wrd="" ) {
 Static A=0, B=1, C=2, D=3, E=0, F=1, G=2, H=0, I=0, J=2, K=2, L=4, M=5
 Static N=5, O=0, P=1, Q=2, R=6, S=2, T=3, U=0, V=1, W=0, X=2, Y=0, Z=2
 StringUpper, Wrd, Wrd
 Pre:=SubStr( Wrd,1,1 ), Prv:=%Pre%, Word:=SubStr(Wrd,2)
 Loop, Parse, Word
  If ( Asc(A_LoopField)>64 && Asc(A_LoopField)< 91 )
       StringReplace, Word, Word, %A_LoopField%, % %A_LoopField%
  Else StringReplace, Word, Word, %A_LoopField%
 Loop, Parse, Word
   SE .= A_LoopField=Prv ? "" : Prv:=A_LoopField
 StringReplace,SE,SE,0,, All
Return Pre SubStr( SE "000", 1,3 )
}

words=crazy|crazie|craezie|crazi|crasie|cracie|crecie|crazee|crezie|crraazziiee
Loop, Parse, words, |
  List .= A_LoopField "`t=  " SoundExC( A_LoopField ) "`n"
MsgBox, % List


Note: Leading spaces, if any, should be trimmed out before passing it to SoundExC()

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2009, 12:06 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
FA() - A Tiny 2L Function to maintain a single dimension UINT array

Code:
FA(E=0,V="",S="") { ; www.autohotkey.com/forum/viewtopic.php?p=242750#242750
 Static C,P
Return ((E+0)>=0&&V="")?(NumGet(P+0,E*4)):(E&&(V+0)>=0)?(NumPut(V,P+0,E*4)-4):(S="+"&&V
 >0)?((O:=NumPut((V:=NumGet(E*4+P)+V),E*4+P))-O+V):(S="-"&&V>0)?((O:=NumPut((V:=NumGet(E*4
 +P)-V),E*4+P))-O+V):(E>0&&V="Init")?(VarSetCapacity(C,(E+1)*4,0)+(P:=NumPut(E,C)-4)-P):(E
 ="Rel"&&P)?((P:=0)+VarSetCapacity(C,0)+1):(E="Ptr"&&P) ? P : ""
}

; The above ternary version was derived from following code

/*

FA( E=0,V="",S="" ) {
 Static C,P

 If ((E+0)>=0&&V="")                                           ;  NumGet
  Return (NumGet(P+0,E*4))

 If (E&&(V+0)>=0)                                              ;  NumPut
  Return (NumPut(V,P+0,E*4)-4)

 If (S="+"&&V>0)                                               ;  NumAdd
  Return ((O:=NumPut((V:=NumGet(E*4+P)+V),E*4+P))-O+V)

 If (S="-"&&V>0)                                               ;  NumSub
  Return ((O:=NumPut((V:=NumGet(E*4+P)-V),E*4+P))-O+V)

 If (E>0&&V="Init")                                            ;  Init Var
  Return,(VarSetCapacity(C,(E+1)*4,0)+(P:=NumPut(E,C)-4)-P)

 If (E="Rel"&&P)                                               ;  Release Var
  Return ((P:=0)+VarSetCapacity(C,0)+1)

 If (E="Ptr"&&P)                                               ;  Obtain Pointer
  Return P
}

*/



The primary objective of this function is to provide a mechanism to share Integers between functions, thereby avoiding a clutter of Global variables.
In short, FA() is a function that acts as an single dimension array

The parameters are cumbersome to document, and so, I provide here example calls, instead.

Basic:
Code:
FA(10,"Init")   ; Initialise capacity for 10 UINT elements
               ; Returns the Static Variable's size

FA(6,25000)     ; Put 25000 in element 6
               ; Returns the pointer to the UINT

FA(4,0)         ; Nullify element 4
               ; same as above

FA(7)           ; Return the value stored in element 7



Extended:
Support for counters.

Code:
FA(6,1230,"+")  ; Increment the value stored in element 6 by 1230
               ; Returns the new value

FA(6,1230,"-")  ; Decrement the value stored in element 6 by 1230
               ; Returns the new value


For any further manipulation, the pointer to the array can be retrieved..

Code:
FA("Ptr")


..and to release/reset the array

Code:
FA("Rel")



My Requirement:
With forth-coming release: 1.0.48, using ProcAddress directly in DllCall() would increase the performance significantly. I needed a mechanism to initialise the and share the ProcAddresses between many functions of the same wrapper - without creating global variables, and hence I wrote FA()

The following is a dumb, but working example of my intended use.

Code:
MsgBox, % FormatBytes( GetFileSize( A_AhkPath ) )
MsgBox, % FormatBytes( GetFileSize( A_ScriptFullPath ) )

GetFileSize( File ) { ; 4GB Limit
 Static Init,FOpen,FSeek,FClose
 If !Init
   Init:=InitAPI(), FOpen:=FA(1),FSeek:=FA(3),FClose:=FA(4)
 If ( H := DllCall(FOpen,Str,File,Int,0x0) ) < 1
    Return H
 FilePointer := DllCall(FSeek,Int,H,Int,0,Int,2), DllCall(FClose,UInt,H)
Return FilePointer
}

FormatBytes( Bytes ) {
 Static FormatBytes
 If !FormatBytes
     FormatBytes:=FA(11), VarSetCapacity(Formatted,16)
 DllCall(FormatBytes, Int64,Bytes, Str,Formatted, UInt,16 )
Return Formatted
}

InitAPI() {
 Static Funx
 IfNotEqual,Funx,,Return,Funx
 FA( 20, "Init" ) ; Initialise 20 UINT elements

 Kernel32 := DllCall( "GetModuleHandle", Str,"Kernel32.dll" )
 FA( 1, DllCall( "GetProcAddress", UInt,Kernel32, Str,"_lopen"  ) )
 FA( 2, DllCall( "GetProcAddress", UInt,Kernel32, Str,"_lread"  ) )
 FA( 3, DllCall( "GetProcAddress", UInt,Kernel32, Str,"_llseek" ) )
 FA( 4, DllCall( "GetProcAddress", UInt,Kernel32, Str,"_lclose" ) )
 FA( 5, DllCall( "GetProcAddress", UInt,Kernel32, Str,"_lcreat" ) )
 FA( 6, DllCall( "GetProcAddress", UInt,Kernel32, Str,"_lwrite" ) )
 FA( 7, DllCall( "GetProcAddress", UInt,Kernel32, Str,"RtlMoveMemory" ) )

 ShlwAPI := DllCall( "LoadLibrary", Str,"Shlwapi.dll" )
 FA( 11, DllCall( "GetProcAddress", UInt,ShlwAPI, Str,"StrFormatByteSize64A" ) )
 ; unused elements are for future use
Return (Funx:=1)
}

FA(E=0,V="",S="") { ; www.autohotkey.com/forum/viewtopic.php?p=242750#242750
Static C,P
Return ((E+0)>=0&&V="")?(NumGet(P+0,E*4)):(E&&(V+0)>=0)?(NumPut(V,P+0,E*4)-4):(S="+"&&V
 >0)?((O:=NumPut((V:=NumGet(E*4+P)+V),E*4+P))-O+V):(S="-"&&V>0)?((O:=NumPut((V:=NumGet(E*4
 +P)-V),E*4+P))-O+V):(E>0&&V="Init")?(VarSetCapacity(C,(E+1)*4,0)+(P:=NumPut(E,C)-4)-P):(E
 ="Rel"&&P)?((P:=0)+VarSetCapacity(C,0)+1):(E="Ptr"&&P) ? P : ""
}



Last edited by SKAN on July 12th, 2009, 7:13 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 31st, 2009, 9:42 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
GetDeviceSerialFromUSBdrive()

2009-06-08: Deprecated, does not work in Vista! Use USBD_GetDeviceSerial() instead

Given an USB Storage Drive Letter, this function will retrieve the Serial Number and the Friendly name of the USB device by looking up the registry.

Reference: Ask for Help topic: possible to tell une usb stick from another?

Quote:
Note: Limited testing done only in XP SP2 - with available HW ( Flash Sticks, DSC, MP3 Player and Card Reader ) and results were compared with USBDeview


Code:
MsgBox, % GetDeviceSerialFromUSBdrive( "J:" ) ; Usage Example

GetDeviceSerialFromUSBdrive( Drv="" ) {
 DriveGet, DriveType, Type, %Drv%
 IfNotEqual,DriveType,Removable, Return
 RegRead, Hex, HKLM, SYSTEM\MountedDevices, \DosDevices\%Drv%
 VarSetCapacity(U,(Sz:=StrLen(Hex)//2)),  VarSetCapacity(A,Sz+1)
 Loop % Sz
  NumPut( "0x" . SubStr(hex,2*A_Index-1,2), U, A_Index-1, "Char" )
 DllCall( "WideCharToMultiByte", Int,0,Int,0, UInt,&U,UInt,Sz, Str,A,UInt,Sz, Int,0,Int,0)
 StringSplit, Part, A, #
 ParentIdPrefixCheck := SubStr( Part3,1,InStr(Part3,"&",0,0)-1 )
 Loop, HKLM, SYSTEM\CurrentControlSet\Enum\USBSTOR,1,0
 { Device := A_LoopRegName
   Loop, HKLM, SYSTEM\CurrentControlSet\Enum\USBSTOR\%Device%,1,0
 { Serial := A_LoopRegName
   RegRead, PIPrefix, HKLM, SYSTEM\CurrentControlSet\Enum\USBSTOR\%Device%\%Serial%
          , ParentIdPrefix
   If ( PIPrefix = ParentIdPrefixCheck ) {
   RegRead, DeviceFN, HKLM, SYSTEM\CurrentControlSet\Enum\USBSTOR\%Device%\%Serial%
          , FriendlyName
   Return, SubStr( Serial,1,InStr(Serial,"&",0,0)-1 ) " " DeviceFN
}}
}}


:)



Snippet 1: Use a Removable Drive as a Key ( to lock / unlock your computer.. etc. )

Code:
DeviceFound := False
DriveFN := "GDLL4HW4 JetFlash TS4GJFV30 USB Device"
DriveGet, Drvs, List, Removable
Loop, Parse, Drvs
 If ( GetDeviceSerialFromUSBdrive( A_LoopField ":" ) == DriveFN ) {
      DeviceFound := True,  Drv := A_LoopField ":"
      Break
   }
If DeviceFound
     MsgBox, 64, USB Device Found, % DriveFN "`nfound in Drive " Drv
Else MsgBox, 16, USB Device Not Found, %DriveFN%
Return

; Copy/Paste GetDeviceSerialFromUSBdrive()


Snippet 2: Force your Compiled script to load only from a particular Removable Drive

Code:
SplitPath, A_ScriptFullPath,,,,, Drv
If ! ( GetDeviceSerialFromUSBdrive( Drv ) == "GDLL4HW4 JetFlash TS4GJFV30 USB Device" ) {
  MsgBox, 16, MySofwareName, Software Access Denied!`nThe Application will quit now, 7
  ExitApp
   }
   
; Copy/Paste GetDeviceSerialFromUSBdrive()


Report this post
Top
 Profile  
Reply with quote  
 Post subject: PixelCheckSum()
PostPosted: June 8th, 2009, 12:10 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
PixelCheckSum()

Generates a CheckSum for a region of pixels in Screen/Window

Credit: Thanks to Sean. Screen Capture with Transparent Windows and Mouse Cursor

Code:
PixelCheckSum( X=0, Y=0, W=3, H=3, Title="" ) {
 hWn := WinExist( Title ), hDC := DllCall( "GetDC", UInt,hWn )
 mDC := DllCall( "CreateCompatibleDC", UInt,hDC )
 NumPut( VarSetCapacity(BI,40,0),BI ), NumPut( W,BI,4 ) , NumPut( H,BI,8 )
 NumPut( 32,NumPut( 1,BI,12,"UShort" ),0,"UShort" )     , NumPut( 0,BI,16 )
 hBM := DllCall( "CreateDIBSection", UInt,mDC, UInt,&BI , Int,0, UIntP,pB, Int,0,Int,0 )
 oBM := DllCall( "SelectObject", UInt,mDC, UInt,hBM )   , Rop := 0x40000000|0x00CC0020
 DllCall( "BitBlt", UInt,mDC, Int,0,Int,0, Int,W,Int,H, UInt,hDC, Int,X,Int,Y, UInt,Rop )
 DllCall( "shlwapi\HashData", UInt,pB, UInt,W*H*4, Int64P,Hash, UInt,8 )
 VarSetCapacity(HH,16,0), DllCall( "msvcrt\sprintf", Str,HH, Str,"%016I64X",UInt64,Hash )
 DllCall( "DeleteObject", UInt,hBM ), DllCall( "DeleteObject", UInt,oBM )
 DllCall( "DeleteDC", UInt,mDC ), DllCall( "ReleaseDC", UInt,hWn, UInt,hDC )
Return HH
}


Code:
; Example - Wait for a Screen Region to change
ChkSum := PixelChecksum( 0,0,10,10 )
While % ( ChkSum = PixelChecksum( 0,0,10,10 ) )
  Sleep, 100
MsgBox, Screen Region Change Detected!
Return



:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2009, 6:12 pm 
Excellent! (as always)...

8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 1:35 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
@daonlyfreez: Thanks friend :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2010, 2:32 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
ShellFileOperation doesn't work with FTP servers. Calling it like this:
ShellFileOperation(0x2,"C:\Program Files\AutoHotkey\main.exe","ftp://user@autohotkey.net/",0,0)

Shows a dialog asking if a path "C:\Program Files\AutoHotkey\ftp:\" should be created, and then it either fails with a Cancelled error system code or with a 123 code indicating a path with wrong format.

For now I'm going to avoid that by using a different transfer function for ftp, but it would be nice to see the windows dialogs for it, and I believe it should be possible since explorer can do it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 9:07 pm 
Offline

Joined: October 15th, 2007, 3:10 pm
Posts: 790
Location: England
fragman wrote:
ShellFileOperation doesn't work with FTP servers... I believe it should be possible since explorer can do it.


I think that when you put the ftp protocol in the address bar of explorer (i.e. typing ftp://whatever), windows actually swiches to using Internet Explorer to do that for you, and not Explorer (the file explorer). So Explorer can't do it... (as far as I am aware). It's not a standard Shell File Operation.

Try something like this WININET wrapper for an FTP solution.

Another alternative is to use this libcURL wrapper.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 9:09 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I'm currently transferring files using the wrapper, but I want to show native transfer dialogs, so the user can also get replacement questions, progress etc.

(internet?) Explorer can do the transfer, even with files from clipboard, maybe I can find a way to remote control a hidden explorer window or so.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 166 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11, 12  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cerberus, Exabot [Bot] and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group