Jump to content

Search the Community

Showing results for tags 'ShellExecute'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. Hello Team, Greetings! Is there any way to run any 3rd party application silently in background without the GUI getting in the front ? I was implementing angry-ip scanner with autoit & wanted the angry-ip application to run in background quietly as I am copying its output to other file on completion. is there any way to achieve my query? Below is code I tried: $range = "192.168.0.1 192.168.0.255" ShellExecuteWait("C:\Windows\DDM\ipscan.exe","-f:range "&$iprange&" -q -o C:\temp\ScanResults.csv","","open",@SW_HIDE) Thanks!
  2. Hi there! 😃 I've 2 simple scripts: Script 1 starts script 2 Script 1 gets executed with normal user rights (un-elevated) Script 2 contains an #RequireAdmin and therefor can only start elevated I want to read the output of script 2 with script 1 AND have the UAC of script 2 being activated as fullscreen Script 1 (Scripts location is the same as script 2 that I'm running with Run() Local $iPID, $sOutput $iPID = Run(@ComSpec & " /c " & "C:\Entwicklung\Autoit\Test\Temp.exe", @ScriptDir, @SW_HIDE, 0x2) ProcessWaitClose($iPID) $sOutput = StdoutRead($iPID) StdioClose($iPID) ConsoleWrite($sOutput) MsgBox(1, 1, 1) Script 2 (compiled as Temp.exe) #RequireAdmin ConsoleWrite("Return") MsgBox(1,1,"ADMIN") Now my problems are the following: Without the #RequireAdmin I can read the output with no problem, but not with the #RequireAdmin ($sOutput is empty) Using @SW_HIDE in the Run() command makes the UAC always start minimized (see attached picture) and the admin has to always manually click on the icon to enter his credentials since the UAC doesn't start in fullscreen. Here and on a few other sites they explain that the program launching the elevated program NEEDS to be activated in order to directly show the UAC fullscreen and not minimized. Using @SW_SHOW would get rid of the problem, BUT that leaves me with an ugly cmd.exe floating the whole time while the elevated script ist running. And my questions to that I'm seeking an answer for are: Problem 1: Is it just not possible to read from an elevated program with an un-elevated user/script? I also get the Access Denied if I press No on the UAC as an Output in $sOutput (Guess since its's still un-elevated) Problem 2: Is there a way to either make the floating black and blank cmd.exe being moved to the background and be non visible to the user OR to somehow bring the minimized UAC to the foreground/fullscreen? What I already tried and what didn't help me: $iPID = Run(@ComSpec & " /c " & "C:\Entwicklung\Autoit\Test\Temp.exe", @ScriptDir, @SW_HIDE, 0x2) While Not WinExists("Temp.exe erfordert Ihre Berechtigung") ConsoleWrite(1) WEnd WinActivate("Temp.exe erfordert Ihre Berechtigung") WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_SHOW) WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_MAXIMIZE) WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_ENABLE) The While-Loops helps a lot and also stops after a second or so (► Stops to write ones (1)). That means that the actual "window" of the UAC is found, but all the WinXXX functions don't do anything and the UAC stays minimized. I also tried to minimized/move the cmd.exe to the background with WinActivate() and WinSetState() with no success. $iPID = ShellExecute("C:\Entwicklung\Autoit\Test\Temp.exe", "", @ScriptDir, "open", @SW_HIDE) Using ShellExecute() instead of Run() completely solves the UAC to fullscreen problem BUT I haven't found a consistent way to read the output of ShellExecute(). Neither here on the forum nor somewhere else. If I'd be possible to read the output from ShellExecute() then all my problems would be solved at once! Also tried a few more things and playing with some parameters but everything with no success. I'd really love some help and support here from you. Thanks in advance!
  3. I need to save the execution result as a text file. Is there any solution? ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] ) if parameters have " > " can't Execute correctly, Example 1: ShellExecute("diskspd.exe", "-b128K -c64M f:\estfile.dat > test123.txt", "", "", @SW_MAXIMIZE) ;Error ShellExecute("diskspd.exe", "-b128K -c64M f:\estfile.dat", "", "", @SW_MAXIMIZE) ;OK Example 2: ShellExecute("help", "dir > helpdir.txt", "", "", @SW_MAXIMIZE) ;Error ShellExecute("help", "dir", "", "", @SW_MAXIMIZE) ;OK T1.au3
  4. Hello and Good Day to All! I am trying to install .NET 3.5 on Windows 10 x64bit via autoit (via ShellExecuteWait + PowerShell). If I run this line, it will runs without issues: ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\OJP83BU523.ps1' & '"') "OJP83BU523.ps1" contains: DISM /Online /Enable-Feature /FeatureName:NetFX3 /All /Source:D:\Sources\sxs /LimitAccess However, since I won't know in advance the drive letter of the "sources" folder, I created a script to generate a PowerShell Script to give a correct path for it. With the modified script below, PowerShell only blinks and nothing happens ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\' & $filename & '"') or ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & $filename & '"') I wish I know the difference with "$filename" and "\OJP83BU523.ps1" usage, as for me, it should be the same. Attached is my entire autoit script. any help is appreciated!, many thanks in advance! test.au3
  5. I created an application to catch keyboard programmed keys. Some of the keys open URL's via ShellExecute and then they open in the default browser. The problem I am having is that when the browser is opened in this manner 3rd party applications such as Logitech Setpoint for Logitech mouse and keyboards and programs like auto password form filling stop working with the browser. In the mouse specific situation the Cruise Up and Cruise Down buttons, normally back and forward, do not work. If I open the browser manually via the browsers icon and then press the keyboard buttons to open the web page everything works normally. I have two questions: 1: Why does ShellExecute("http://www.autoitscript.com") when the browser is not open and then is launched, via the above line, cause third party apps to not be able to interface with the browser? 2: What is a better way to launch URL's if not via ShellExecute? The application is NOT using #RequireAdmin and is not 64bit.
  6. Is this possible with autoit? What I want to do: Create a Desctop windows shortcut to run an executable application created with autoit, which shortcut would have some parameters which will send as a variable to the aplicagion . For example: Create an app : ExampleAppCreatedByAutoit.exe Run this with a shortcut which has: "C:/ExampleAppCreatedByAutoit.exe" -option1 What I want to do is the ExampleAppCreatedByAutoit.exe take the option1 and do something like this: Shellexecute("c:\myfolder\option1.exe") Can I do that? Thanks,
  7. Hello, for a script to display PDF files I'd like to simply use the default program for PDF files, so I used "ShellExecute(<pdf-file-full-path>)" to open these files. The result for *SOME* of the workstations is, that the Adobe Reader starts up with asking for its language. (English/German). When starting AcroRd32.exe through "ShellExecute()", this "choose your language" dialog is showing up *ALWAYS*. Just to have mentioned it: Process Explorer is presenting this command line, it looks the same for both, PCs with and without that question "Choose Language? [English|German]" "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" --channel=4680.0.860715181 --type=renderer "\\pc0009\Y_DRV_H\Daten\TIF\08\32\G000110832_Freigegeben.idw.pdf" The next approach I thought of was to use Foxit Portable (instead of Acrord32.exe), started from a Network Drive, but it's starting up ugly slowly... So I tried to "Run()" instead to "ShellExecute()" the Adobe Reader. Now the result looks more stange, the "select your language" dialog shows up every now and then, but not always for the Win7 installations affected. If I place a "msgbox()" just in front of the "run()" command, it seems never to show this "select your language" dialog. If I take out this MsgBox() the "select your language" dialog shows up sometimes. When I "ClipPut()" the run command prior the "Run()" and paste that one to a CMD box, then it seems to *NEVER* happen, that this "select your language" dialog shows up. "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" "\\pc0009\Y_DRV_H\Daten\TIF\08\32\G000110832_Freigegeben.idw.pdf" $AcroRead='"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"' $PDF='"Y:\Temp\DRV_H\Daten\TIF\33\85\153385_Freigegeben.dwg.pdf"' MsgBox(0,"Values",$AcroRead & @CRLF & $PDF,1) $MyCommand=$AcroRead & " " & $PDF ClipPut($MyCommand) Run($MyCommand) It looks like, that this "--channel=... --type=renderer" parameters are always fact for the AcroRd32.exe instance, that is opening the PDF to be displayed. The Instance opening the "PDF Display GUI" seems to always be a child process of another AcroRd32.exe process. Any clue, what's going on "backstage" here? How to avoid this "Choose your language" dialog? Or maybe someone can mention a different "portable" PDF viewer, I could use for this purpose? Any suggestions appreciated, regards, Rudi.
  8. Hi~ I have some question about how to enable the test mode via "Run" or "shellexecute" of command, was to tried : ----- Run("bcdedit.exe /-set testsinging on", "C:\Windows\System32") and shellexecute("bcdedit.exe /-set testsinging on", "C:\Windows\System32") ----- since this command must to run through administrator competence, have any method can accomplish it?
  9. Hello all, I've been trying to figure out how to launch Google Chrome in the background (hidden) but it doesn't seem possible. I've tried the following methods: ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "", "", "", @SW_HIDE) Also I've tried: ShellExecute(@ComSpec, "/c start chrome.exe","","",@SW_HIDE) Lastly I tried: RunWait('"'&@ProgramFilesDir&'\Google\Chrome\Application\chrome.exe" --silent-launch',@ScriptDir) But all of them launch my chrome browser without hiding it. Does anyone know a workaround for this or if AutoIT just can't Chrome? Bonus points if you know how to make it launch chrome hidden and make it go to https://www.autoitscript.com Thank you, Brian
  10. How to get the result of the command? My code : Local $iRc = ShellExecute ( "G:\ffmpeg\bin\ffmpeg.exe" , "-version" , "G:\ffmpeg\bin\") ProcessWaitClose($iRc) $Message = StdoutRead($iRc)
  11. I want to run a python script from autoit. I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments. How to pass them from autoit script? I tried many ways. Following solution also not working e.g. RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution: RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path') PFB description: https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
  12. Hey Community, cause im too new in the Auto it world i will try it with the your help. hopefully. I woud like to know how i can handle my Problem. ---- I have a Excel Data with 362 random numbers. For Example: 1166642335374 1172899897343 ..... this numbers are a part of the filepath ...example D:\Projekte\1166_64233_5374 as u can see its the first number of the Excel data. After the first 4 numbers it shoud make a "_" than another 5 "_" This is my first question. How can i handle this to make it Shell execute. -------- Second question: If i am in the path. For Example: D:\Projekte\1166_64233_5374 the code shoud search for specific PDF Files. They are named like: 0050569E364B1ED79B900F73E62660EC.pdf the first 15 letters are always the same 0050569E364B1ED when he found this data he has to copy it on a Folder on the Desktop. (There can also be 2 or 3 pdfs in one Folder with this letters) ---- Please give me some help :-)
  13. Hello, What command would I use to open the following folder directories for: Computer/This PC (windows 7/Windows 10) Libraries\documents Libraries\Pictures I know:  Run("Explorer.exe " & $filepath) ShellExecute($filepath) can be used to open folder locations when you type in the full directory such as "C:\Users\%username%\Documents" but I'm trying to figure out how to use these windows short paths. Thanks,
  14. Hi. Local $sPDFtk = FileGetShortName(@ScriptDir & "\pdftk.exe") Local $sInputPDF = FileGetShortName(@ScriptDir & "\Prodis_Test.pdf") Local $sSig_1 = FileGetShortName(@ScriptDir & "\Sig_1.pdf") Local $sTempPDF = FileGetShortName(@ScriptDir & "\Prodis_Test_TEMP.pdf") $iSuccess = ShellExecuteWait($sPDFtk, $sInputPDF & " stamp " & $sSig_1 & " output " & $sTempPDF, "", "", @SW_HIDE) @ScriptDir is "H:\_Conrad lokal\Downloads\AutoIt3\_COX". As you can see there is a space in the path. I know that ShellExecuteWait is working with FileGetShortName at the filename. It seems to me that I can't pass the parameters that way. But without FileGetShortName it's not working too. Ideas? Regards, Conrad
  15. I have 3 processes that I am trying to work with: The ControlCenter (Cannot Edit) and handles the other 2 processes. The ControlCenter will launch and close processes as requested by the user. The Launcher (Can Edit) and launches an installer. The Script (Can Edit) and automates the above installer. My issue is, ControlCenter will terminate the Launcher and all of it's child processes. I need the script to continue running after the Launcher has been closed by the ControlCenter. How do I get the Launcher to launch the script in it's own parent process so it does not get terminated when the ControlCenter terminates the launcher and all child processes? Sorry if this is confusing. I am terrible at explaining things. Autism can be a pain to deal with sometimes.
  16. Hi friends, Suppose MyProgram is a tabbed program, meaning that it allows for opening multiple files in the same instance. I want to open File1, File2 and File3 in one instance of MyProgram from an AutoIT script. How can I do this? I have read the AutoIT Help File about "ShellExecute" and "Run", but I have found nothing helpful. Thanks for reading my question. Any answer would be very appreciated.
  17. Okay, so I have a TCP connection set up over some computers, no problem. I recieve the messages without problem, and when I get a specific message over the server, it runs some program. No problem at first. But then, after the whole script has ran for a while, it won't open any program, not even a web page like ShellExecute("www.google.com"). It just returns @error=1. It's nothing wrong with the path, FileExists makes sure of that (Always returns 1). When I then try using Run instead of ShellExecute, I still get an error. Any idea why it just works at first, but then starts to fail every time? Relevant for opening a specific file: ShellExecute(@DesktopDir & "\Fireplace.mp4") If @error Then FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - ShellExecute Error: " & @error & " & Extended: " & @extended & @CRLF) $Exists=FileExists(@DesktopDir & "\Fireplace.mp4") FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - Exists: " & $Exists & " & exists error: " & @error & " & Extended: " & @extended & @CRLF);;;;;;;;;;; Run(@DesktopDir & "\Fireplace.mp4") If @error Then FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - Run Bål Error: " & @error & " & Extended: " & @extended & @CRLF) EndIfWhole client: #Include <_AudioEndpointVolume.au3> #include <Process.au3> TCPStartup() OnAutoItExitRegister("Terminate") $IPAdress="My personal IP..." $Port= Some IP... Local $Socket Connect() While 1 Sleep(50) Recv() If _IsInternetConnected()=False Then Connect(2) WEnd Func Recv() $Recv=TCPRecv($Socket, 2048) If @error>0 Then Connect(@error & " " & @extended) If $Recv="" Then Return FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - Recieved " & $Recv & @CRLF);;;;;;;;;;; $Recv=StringReplace($Recv, @CR, "") CheckForAction($Recv) EndFunc Func Connect($Conn=0) TCPCloseSocket($Socket) FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - Connection mode " & $Conn & @CRLF);;;;;;;;;;; TraySetIcon(@ScriptDir & "\icons\offline.ico") Do Sleep(1000) $Socket=TCPConnect($IPAdress, $Port) Until Not @error TraySetIcon(@ScriptDir & "\icons\online.ico") TCPSend($Socket, "ImMain") EndFunc Func CheckForAction($_Recv) If $_Recv="vg" Then ShellExecute("www.vg.no") Return True EndIf If $_Recv="bål" Or $_Recv="bÃ¥l" Then ShellExecute(@DesktopDir & "\Fireplace.mp4") If @error Then FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - ShellExecute Error: " & @error & " & Extended: " & @extended & @CRLF) $Exists=FileExists(@DesktopDir & "\Fireplace.mp4") FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - Exists: " & $Exists & " & exists error: " & @error & " & Extended: " & @extended & @CRLF);;;;;;;;;;; Run(@DesktopDir & "\Fireplace.mp4") If @error Then FileWrite(@DesktopDir & "\MultiClientMainLog.txt", @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & " - Run Bål Error: " & @error & " & Extended: " & @extended & @CRLF) EndIf Sleep(1000) Send("f") Return True EndIf If $_Recv="exit" Then Send("{ALTDOWN}{F4}{ALTUP}") Return True EndIf If $_Recv="opp" Then Send("{PGUP}") Return True EndIf If $_Recv="ned" Then Send("{PGDN}") Return True EndIf If $_Recv="endc" Then FileWrite(@TempDir & "\endc.txt", "ok") Return True EndIf If $_Recv="startc" Then FileWrite(@TempDir & "\startc.txt", "ok") Return True EndIf If $_Recv="cbål" Or $_Recv="cbÃ¥l" Then FileWrite(@TempDir & "\endc.txt", "ok") Sleep(3000) ShellExecute(@DesktopDir & "\Fireplace.mp4") Sleep(1000) Send("f") Return True EndIf If StringLeft($_Recv, 3)="cmd" Then _RunDOS(StringTrimLeft($_Recv, 4)) Return True EndIf If StringLeft($_Recv, 3)="au3" Then If FileExists(@TempDir & "\Run.au3") Then FileDelete(@TempDir & "\Run.au3") FileWrite(@TempDir & "\Run.au3", StringTrimLeft($_Recv, 4)) ShellExecute(@TempDir & "\Run.au3") Return True EndIf If Stringleft($_Recv, 10)="set volume" Then _SetMasterVolumeLevelScalar(StringTrimLeft($_Recv, 11)) Return True EndIf If StringLeft($_Recv, 4)="send" Then Send(StringTrimLeft($_Recv, 5)) Return True EndIf If StringLeft($_Recv, 4)="www." Then ShellExecute($_Recv) Return True EndIf Return False EndFunc Func _IsInternetConnected() Local $aReturn = DllCall('connect.dll', 'long', 'IsInternetConnected') If @error Then Return SetError(1, 0, False) Return $aReturn[0] = 0 EndFunc ;==>_IsInternetConnected Func Terminate() TCPShutdown() Exit EndFunc
  18. Hey people. I want to keep running a process executed by the main compiled script after I kill the process, using ProcessKill. The problem is that after killing the parent process, the children is also terminated. I tried using Run, ShellExecute (what I need to run are batch commands BTW). Anyway to prevent this behavior? All I can think of is creating a scheduled task to keep it alive after closing the main one, but it might be unreliable, depending on the system.
  19. Good Afternoon All Let me start by saying... I'm not sure if this belongs in the GUI part of the forum as it's more of a loop / code / dynamic GUI layout issue. I understand if you move it though. I have been doing some crazy things in AutoIT lately and one of them just so happens to be an accidental infinite loop. I am dynamically populating my GUI labels... so that means if I have a users ip address I create $L_PP1_WhoISSearch However, if I assign a function to a non existent label... for instance a user has no ip address or it is invalid, I get an infinite loop / crash. The While loop below just goes crazy running ShellExecute. Since the label $L_PP1_WhoISSearch doesn't exist, the function WhoISSearch() just runs ShellExecute to infinity... What should I do differently??? Is there a trigger I can set in the Gui to ignore missing cases??? Sorry, I can only provide "snippets" of my code since it's for work. Thanks you all!!! ; This is my loop of doom if the $L_PP1_WhoISSearch doesn't exist in my gui. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $L_PP1_DashboardLink DashboardLink01() Case $L_PP1_WhoISSearch WhoISSearch() Case $B_PP1_BACK02 GUIDelete() Gui01_PP_INC() Case $B_PP1_EXIT02 Exit EndSwitch WEnd Func WhoISSearch() ShellExecute('http://whois.arin.net/rest/nets;q=' & $PP1_SourceIPClick01 & '?showDetails=true&showARIN=false&showNonArinTopLevelNet=false') ;MsgBox (0, "", 'WTF') EndFunc; This is my dynamic label for my Gui. ElseIf $i = 5 Then $L_PP1_SourceIP = GUICtrlCreateLabel($LabelVariable & ' ' & $aArray_Variable_PP_Gui01[$i], 10, $L_PP1_Var_StartHeight, 316, 19) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") $L_PP1_Var_StartHeight += 22 $L_PP1_WhoISSearch = GUICtrlCreateLabel('WhoIS Search: ' & $PP1_SourceIPClick01, 10, $L_PP1_Var_StartHeight, 316, 19) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") GUICtrlSetColor(-1, 0x0000FF) $L_PP1_Var_StartHeight += 22
  20. I created a Launcher script for work, which checks a network drive for the newest version of a Microsoft Access front end file, updates the user's copy if they have an older version, and then launches the newest version. However, each time it's run, new tasks keep showing up in the Task Manager that don't get closed. I've tracked down the problem to the ShellExecute function. ShellExecute("U:\My Documents\Access DB\Test.accdb") I created a script with a single line of code (above) and ran it 10 times. 2 out of 10 times (2nd run and 10th run), the script opened the Test.accdb file and stopped running, as intended. The other 8 times, the Test.accdb file was opened, but the script kept running indefinitely. It just fails to stop running, and doesn't appear to be doing anything. I can add extra lines of code after Shellexecute, like ConsoleWrite("Am I still running?") and it will run that code, but the script will still fail to exit afterwards.. Does anyone know what the problem is, or how I can avoid it?
  21. If I use the ShellExecute() function to access a URL, it opens IE and directs the browser to the page. This method seems to work flawlessly, but I was wondering whether it would be better to open the link using a different method, or if there is a preferred method? If anyone can advise me on this, I'd be grateful. Thanks.
  22. Hey guys, im writing on my project and got some memory leaks. Actual im looking for the leak for a month and now i got some curios results. I wrote some testscripts, to see, if AutoIt causes memory leaks. So i wrote some testscript for Listviews, Lists, and Labels to see, if i create a Listview with lets say 1000 items and delete them, does AutoIt reset the complete memory of these items? i'd say no. I did some tests and got the result that in best case 4K memory is missing ... Testscript #1: Listview created by nature func in combination with UDF funcs to create and delete items. #include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hListview = GUICtrlCreateListView("Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 _GUICtrlListView_AddItem($hListview, Random(0, 2000)) Next EndFunc Func _delall_items() _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListview)) EndFunc Func _exit() Exit EndFuncTestscript #2: Listview created by UDFfunc in combination with UDF funcs to create and delete items. #include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) local $hListview = _GUICtrlListView_Create($hGUI, "Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 _GUICtrlListView_AddItem($hListview, Random(0, 2000)) Next EndFunc Func _delall_items() _GUICtrlListView_DeleteAllItems($hListview) EndFunc Func _exit() Exit EndFuncTestscript #3: Creating a list #include <GUIConstantsEx.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hList = GUICtrlCreateList("Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 GUICtrlSetData($hList, Random(0, 2000)) Next EndFunc Func _delall_items() GUICtrlSetData($hList, "") EndFunc Func _exit() Exit EndFuncTestscript #4: Working with labels. #include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hlabel = GUICtrlCreateLabel("AP's: ", 10, 45, 100, 440) Local $hlabel2 = GUICtrlCreateLabel("AP's: ", 110, 45, 100, 440) Local $hlabel3 = GUICtrlCreateLabel("AP's: ", 210, 45, 100, 440) Local $hlabel4 = GUICtrlCreateLabel("AP's: ", 310, 45, 100, 440) Local $hlabel5 = GUICtrlCreateLabel("AP's: ", 410, 45, 100, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() Local $sMsg = "" Local $sMsg2 = "" Local $sMsg3 = "" Local $sMsg4 = "" Local $sMsg5 = "" For $i = 0 To 30 $sMsg = $sMsg & Random(1,200) & @CR $sMsg2 = $sMsg2 & Random(1,200) & @CR $sMsg3 = $sMsg3 & Random(1,200) & @CR $sMsg4 = $sMsg4 & Random(1,200) & @CR $sMsg5 = $sMsg5 & Random(1,200) & @CR Next GUICtrlSetData($hlabel, $sMsg) GUICtrlSetData($hlabel2, $sMsg2) GUICtrlSetData($hlabel3, $sMsg3) GUICtrlSetData($hlabel4, $sMsg2) GUICtrlSetData($hlabel5, $sMsg3) EndFunc Func _delall_items() GUICtrlSetData($hlabel, "") GUICtrlSetData($hlabel2, "") GUICtrlSetData($hlabel3, "") GUICtrlSetData($hlabel4, "") GUICtrlSetData($hlabel5, "") EndFunc Func _exit() Exit EndFunc Got someone a statements for me, if its true? Regards Looked up here: http://www.google.com (Also tried to find out if ShellExecute causes problems) and some more...
  23. I'm trying to get some code working with ShellExecute. I would like the Window to execute hidden, but it does not seem to be working when I set the SW_HIDE flag. Any help is much appreciated. Code below: Local $tmp = "C:\Temp" Local $msi = $tmp & '\AdobeFlash.msi' If Not FileExists($tmp) = 1 Then DirCreate($tmp) InetGet("http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_11_plugin.msi", $msi, 0, 0) $afEXE = ShellExecute("AdobeFlash.msi", "", $tmp, "open", @SW_HIDE) Do $run = ControlClick("Adobe Flash Player 11 Plugin - InstallShield Wizard", "", 1669) Until $run = 1 Do $finish = ControlClick("Adobe Flash Player 11 Plugin - InstallShield Wizard", "", 1653) Until $finish = 1 DirRemove($tmp) Thoughts?
  24. Hi, trying to start an exe with parameters, and making a count while it's executing, like this: Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("TrayOnEventMode", 1) SplashImageOn("Intel", "img\intel.jpg", -1, -1, -1, -1, 1) Sleep(1000) SplashOff() ProgressOn("Progress...", "Working", "0 percent") ;ProgressSet(0, "0 %", "Working") If FileExists("MEI_Intel_XP32_Vista_Win7_6001179\setup.exe") Then ShellExecute("MEI_Intel_XP32_Vista_Win7_6001179\SETUP.EXE", "-s") Count() Else MsgBox(64, "FileExists Function", "Intel MEI .exe not found!", 0) Exit EndIf Func Count() For $i = 0 To 100 Step +1 ProgressSet($i, $i & '%', "Working") If ProcessWaitClose("SETUP.EXE") = 1 Then ProgressSet(100, "100 %", "Done!") Sleep(500) ProgressOff() Exit EndIf Sleep(1000) Next ProgressOff() EndFunc ;==>Count Problem is, it runs until it's finished, and im not using SEWait... :S How can i do this, using parameters, and making the count at the same time? Was thinking about some variables, just a loop, and cheking for some variable to become 1 or something like that, think it could work, but im more interested in why the script doens't just continue... PS: I know i don't need to have the count part as a function, considering the script runs normally.
  25. Well ,sometimes if you try to pen firefox hidden or minimized,doesn't work ,and when it works,you can't show it again on the monitor ShellExecute( "C:\Program Files\Mozilla Firefox\firefox.exe","Google - Mozilla Firefox","","open",@SW_HIDE) Sleep(2000) WinSetState( "Google - Mozilla Firefox","",@SW_SHOW)
×
×
  • Create New...