P4T Posted September 22, 2014 Share Posted September 22, 2014 Hello, I'm relative new with autoit, but I can code some simple scripts. I've created a silent installer, which is working, but now I would like to hide all installation windows. AutoIt only can hide the first window, but not all, so I searched for a solution and I've found the function >_shellExecuteHidden I downloaded and installed the requiered WinAPIEx UDF, then I tried to test the function first, because I want to understand how to use it, before I try to make the silent installer with hidden windows. I tried two simple examples given together with the function: expandcollapse popup$hWinHiddenApp = _shellExecuteHidden( @ComSpec , "/c start notepad.exe" ) ShellExecute( "taskmgr.exe" ) MsgBox( 0 , '' , "...´ok look in your taskmanager now. There should be a new notepad.exe entry but no window is visible." ) Func _shellExecuteHidden( $filepath , $parameters = "" , $returnType = 1 , $waitingOption = -1 ) ; 1 - Create Desktop ;Global Const $GENERIC_ALL = 0x10000000 $hNewDesktop = _WinAPI_CreateDesktop( "ShellExecuteHidden_Desktop" , $GENERIC_ALL ) ; 2 - Start Process $tProcess = DllStructCreate( $tagPROCESS_INFORMATION ) $tStartup = DllStructCreate( $tagSTARTUPINFO ) DllStructSetData( $tStartup , 'Size', DllStructGetSize( $tStartup) ) DllStructSetData( $tStartup , 'Desktop', _WinAPI_CreateString( "ShellExecuteHidden_Desktop" ) ) Local $pid If _WinAPI_CreateProcess( $filepath , $parameters , 0, 0, 0, 0x00000200 , 0, 0, DllStructGetPtr($tStartup), DllStructGetPtr($tProcess)) Then $pid = DllStructGetData( $tProcess , 'ProcessID' ) Else Return -1 EndIf ; 3 - Return Process if $returnType = 2 Then if $waitingOption > -1 Then ProcessWaitClose( $pid , $waitingOption ) Return $pid EndIf ; 4 - Return WindowHandle if $waitingOption = -1 Then Sleep( 1000 ) ElseIf $waitingOption > 0 Then Sleep( $waitingOption ) EndIf While True ; keep searching for the window $aWindows = _WinAPI_EnumDesktopWindows( $hNewDesktop , $returnType ) ; $returnType = 0 >> means also list hidden windows if IsArray( $aWindows ) Then for $i = 1 to $aWindows[0][0] ;~ MsgBox( 0 , '' , $curPID & " " & $pid & " " & $hWnd & " " & $aWindows[$i][0] ) $hWnd = $aWindows[$i][0] if $pid = WinGetProcess( $hWnd ) Then ; same process? do ; searching through parent windows ... $hLast = $hWnd ; cache it for not loosing it when desktop is reached $hWnd = _WinAPI_GetParent( $hLast ) Until $hWnd = 0 ; ... until root/ desktop is reached $hWnd = $hLast Return $hWnd ; return the toplevel-window of the process EndIf Next EndIf if $waitingOption = 0 Then ; keep searching for the window until it appears ( in worst case endless ) Sleep( 200 ) Else Return -1 EndIf WEnd EndFunc But if run this scrip, I'll get this error message: >"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UsersP4TDownloadsAutoklickerCaptcha SniperCaptcha Sniper x4.5xx.au3" "C:UsersP4TDownloadsAutoklickerCaptcha SniperCaptcha Sniper x4.5xx.au3" (10) : ==> Unknown function name.: $hNewDesktop = _WinAPI_CreateDesktop( "ShellExecuteHidden_Desktop" , $GENERIC_ALL ) $hNewDesktop = ^ ERROR >Exit code: 1 Time: 0.048 And the other example, I tried: expandcollapse popupMsgBox( 0 , '' , "Now we start an editor on the hidden desktop and interact with it programmaticly" ) $hWinHiddenApp = _shellExecuteHidden( @SystemDir & "\notepad.exe" ) Func _shellExecuteHidden( $filepath , $parameters = "" , $returnType = 1 , $waitingOption = -1 ) ; 1 - Create Desktop ;Global Const $GENERIC_ALL = 0x10000000 $hNewDesktop = _WinAPI_CreateDesktop( "ShellExecuteHidden_Desktop" , $GENERIC_ALL ) ; 2 - Start Process $tProcess = DllStructCreate( $tagPROCESS_INFORMATION ) $tStartup = DllStructCreate( $tagSTARTUPINFO ) DllStructSetData( $tStartup , 'Size', DllStructGetSize( $tStartup) ) DllStructSetData( $tStartup , 'Desktop', _WinAPI_CreateString( "ShellExecuteHidden_Desktop" ) ) Local $pid If _WinAPI_CreateProcess( $filepath , $parameters , 0, 0, 0, 0x00000200 , 0, 0, DllStructGetPtr($tStartup), DllStructGetPtr($tProcess)) Then $pid = DllStructGetData( $tProcess , 'ProcessID' ) Else Return -1 EndIf ; 3 - Return Process if $returnType = 2 Then if $waitingOption > -1 Then ProcessWaitClose( $pid , $waitingOption ) Return $pid EndIf ; 4 - Return WindowHandle if $waitingOption = -1 Then Sleep( 1000 ) ElseIf $waitingOption > 0 Then Sleep( $waitingOption ) EndIf While True ; keep searching for the window $aWindows = _WinAPI_EnumDesktopWindows( $hNewDesktop , $returnType ) ; $returnType = 0 >> means also list hidden windows if IsArray( $aWindows ) Then for $i = 1 to $aWindows[0][0] ;~ MsgBox( 0 , '' , $curPID & " " & $pid & " " & $hWnd & " " & $aWindows[$i][0] ) $hWnd = $aWindows[$i][0] if $pid = WinGetProcess( $hWnd ) Then ; same process? do ; searching through parent windows ... $hLast = $hWnd ; cache it for not loosing it when desktop is reached $hWnd = _WinAPI_GetParent( $hLast ) Until $hWnd = 0 ; ... until root/ desktop is reached $hWnd = $hLast Return $hWnd ; return the toplevel-window of the process EndIf Next EndIf if $waitingOption = 0 Then ; keep searching for the window until it appears ( in worst case endless ) Sleep( 200 ) Else Return -1 EndIf WEnd EndFunc The error message: >"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UsersP4TDownloadsAutoklickerCaptcha SniperCaptcha Sniper x4.5xx.au3" "C:UsersP4TDownloadsAutoklickerCaptcha SniperCaptcha Sniper x4.5xx.au3" (9) : ==> Unknown function name.: $hNewDesktop = _WinAPI_CreateDesktop( "ShellExecuteHidden_Desktop" , $GENERIC_ALL ) $hNewDesktop = ^ ERROR >Exit code: 1 Time: 3.789 How I said, I don't have much experience, but I think it cannot be such a big problem to run a given example script for a function. I've only installed the required WinAPIEx UDF and copied the code for the example and the function. So, can anyone explain me what I have done wrong or what I have missed? I'm using AutoIt v3.3.10.2 Thanks. Link to comment Share on other sites More sharing options...
j0kky Posted September 22, 2014 Share Posted September 22, 2014 "Captcha sniper"? Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
P4T Posted September 22, 2014 Author Share Posted September 22, 2014 "Captcha sniper"? Yes, why do you wonder? I've saved the script in the folder named Captcha Sniper, because I've build the silent installer for captcha sniper and how I wrote, I want use the _shellExecuteHidden function in my silent installer script. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 22, 2014 Moderators Share Posted September 22, 2014 I believe jokky was (apparently too subtly) trying to point you to the forum fules, which prohibit discussion of bypassing security measures, including captchas "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 22, 2014 Moderators Share Posted September 22, 2014 P4T,That is not an app we wish to help you install. Thread closed. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts