Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all 12506 articles
Browse latest View live

How to open a file

$
0
0

Hello,

 

How can I open a file which is not a executable, like a .docx or .txt..... I would prefer answer which works for all files regardless of the extension :)

 

TD :)


Is it possible to start any exe file with SciTE and end with SciTE

$
0
0

Hi all, 

I have made a script and made an exe from it. Now i need to run it with SciTE and end it with SciTE. That means, when i start SciTE, this exe should start and when i close SciTE, this exe should close. Is it possible ?

AutoIT and AHK

$
0
0

very new to AutoIT

I do have AutoIT running in a terminal service environment

I have also bee using AHK for all of my automation scripts

I am trying to use a start up script to point to INI file that will give that session info of what to do

in this case i just want to autostart a AHK script, but for some reason it works, however it keeps repeating the start up over and over... and in this case opening PPT slideshow one after another

slider question

$
0
0

Hi,

 

I have a basic slider, with numbers between 1 & 100 and the slider works fine, I click a button which displays a msgbox containing the selected number from the slider control but is there a way I can make the slider show the current number as the user slides up & down - like in a small balloon tip above the slider for example? because the user doesnt know which number is selected until the msgbox is displayed.

 

Thanks

Call Tips for Variables?

$
0
0

Hey, 

 

Happy Friday from Boulder CO.

 

In my automation setup I have a Test Case file which contains oddly enough test cases and functions specific to those test case. A function file that contains utility Functions and a Variables file which contains variables to be shared across multiple other files. Rhetorical question: Is this a good setup? I don't know it works for me.

 

Sometimes when I'm writing a test case I remember, "hey, I have a variable I could use here it something like $sEntity... but I have several variables that start with $sEntity. It's at the point I'd like to have a Call Tip pop up and show me all the variables starting with $sEntity and what their value is, instead of having to open the Variables file and do a search for $sEntity.

 

Is there such a way to do this, like the way to create Call Tips for my own functions?

 

I looked around here and The Interwebs. I didn't find what I was looking for.

 

Thanks for the help.

Weird Browser Issue

$
0
0

Im running a test to make sure browsers connect properly to the internet like this

            If ProcessExists('iexplore.exe') Then ProcessClose('iexplore.exe')             If ProcessExists('chrome.exe') Then ProcessClose('chrome.exe')             If ProcessExists('firefox.exe') Then ProcessClose('firefox.exe')             Sleep(200)             ShellExecuteWait('iexplore.exe')             Sleep(200)             If FileExists(@ProgramFilesDir & '\Google\Chrome\Application\chrome.exe') Then ShellExecuteWait('chrome.exe')             Sleep(200)             If FileExists(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe') Then ShellExecuteWait('firefox.exe')             Sleep(200)             If Not ProcessExists('iexplore.exe') Or Not ProcessExists('chrome.exe') Or Not ProcessExists('firefox.exe') Then                 Switch MsgBox($MB_YESNO + $MB_ICONWARNING + $MB_DEFBUTTON2, 'Browsers Check', 'Did All Browsers Work')                     Case $IDYES                         GUICtrlSetImage($BrowserIcon, $tick)                         RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Browser', 'REG_SZ', _Date_Time_SystemTimeToDateTimeStr($CuDate))                     Case $IDNO                         GUICtrlSetImage($BrowserIcon, $cross)                         RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Browser', 'REG_SZ', 'NotCompleted')                 EndSwitch             EndIf

But it hangs like a git between 

            ShellExecuteWait('iexplore.exe')             Sleep(200)             If FileExists(@ProgramFilesDir & '\Google\Chrome\Application\chrome.exe') Then ShellExecuteWait('chrome.exe')

If i reduce it to this

            ShellExecuteWait('iexplore.exe')             Sleep(200) ;~          If FileExists(@ProgramFilesDir & '\Google\Chrome\Application\chrome.exe') Then                 ShellExecuteWait('chrome.exe')             Sleep(200) ;~          If FileExists(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe') Then                 ShellExecuteWait('firefox.exe')

Its instant but then it gives an error that firefox cant be found if its not installed

 

Any suggestions how to stop this hanging

Holding a Process on IECreate()

$
0
0

Opening a a webcam test like this

            Local $oIE = _IECreate('http://www.testmycam.net/')             Sleep(3000)             $WebCamCheck = MsgBox($MB_YESNO + $MB_ICONWARNING + $MB_DEFBUTTON2, 'Webcam Check', 'Did The Webcam Work')             _Font()             If $WebCamCheck = $IDYES Then                 GUICtrlSetImage($WebcamIcon, $tick)                 RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Webcam', 'REG_SZ', _Date_Time_SystemTimeToDateTimeStr($CuDate))             ElseIf $WebCamCheck = $IDNO Then                 GUICtrlSetImage($WebcamIcon, $cross)                 RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Webcam', 'REG_SZ', 'NotCompleted')             EndIf

Im trying to find a way to make the $WebCamCheck wait until the browser window is closed as the MsgBox appears before the test is barely started

I tried adding this after the sleep

            Local $oIE = _IECreate('http://www.testmycam.net/')             Sleep(3000)             Local $ProcessCheck = ProcessExists($oIE) ; <<<<<<<<<< this             ProcessWaitClose($ProcessCheck) ; <<<<<<<<<<<< this             $WebCamCheck = MsgBox($MB_YESNO + $MB_ICONWARNING + $MB_DEFBUTTON2, 'Webcam Check', 'Did The Webcam Work')

but it just carry s on and ignores it :(

 

Any suggestions plz

Remote start scheduled task and wait till it completes

$
0
0

Hello all,

 

First off let me give you some background on the overall process, I'm currently in the process of automating manual tasks we have to do on a few of our servers. These tasks involve running a command line and waiting for it to finish and getting the customer number output it gives us. Once we finish the command line process we have scheduled tasks in place on the servers that we then would manually run and wait for them to complete.

 

The first part of my script (The command line & output) I've been able to automate fine. I actually used one of the GUI's posted on this forum and modified it to fit my needs. The second part of my script (running the scheduled jobs) I'm having a bit of an issue dealing or I really should say, coming up with the most efficient way to get the result I want. Right now although my code works and starts the scheduled task it's alerting me on when the task started rather when it actually completes (sometimes it can take up to 30 to 45 minutes for these scheduled tasks to complete).

 

Below I've included some of my example code, keep in mind each of my GUI buttons I'm simply calling upon a function...

AutoIt         
;;;;;;;;;;;Test Functions;;;;;;;;;;; Func _Test() ;this is the function that runs the command line command (real command is an HP Exstream command, I used ipconfig as an example for testing) SplashTextOn("Task Is Running", "The task is currently running. Please wait till the Task Completed message box with the output appears.", -1, 75) $PID=RunAsWait($Username, $Domain, $Password, 2, @ComSpec & " /c " & "psexec \\remotemachine -u domain\adminaccount -p passwordgoeshere ipconfig > Test.log", "C:\Tools\", @SW_HIDE) ProcessClose ($PID) SplashOff() If $PID = 0 or 4 Then     MsgBox(0,"Task Completed", _TestArray()) ElseIf $PID <> 0 or 4 Then     MsgBox(16, "Error", "The command you were trying to run failed, please contact a System Administrator.") EndIf EndFunc ;==>_Test Func _TestJob() ;this is the function that runs the scheduled task SplashTextOn("Task Is Running", "The task is currently running. Please wait till the Task Completed message box with the output appears.", -1, 75) $PID=RunAsWait($Username, $Domain, $Password, 2, 'psexec \\remotemachine -u domain\adminaccount -p passwordgoeshere schtasks /Change /TN "TestTask" /Enable', "C:\Tools\", @SW_HIDE) $PID=RunAsWait($Username, $Domain, $Password, 2, 'psexec \\remotemachine -u domain\adminaccount -p passwordgoeshere schtasks /Run /TN "TestTask"', "C:\Tools\", @SW_HIDE) ProcessClose ($PID) SplashOff If $PID = 0 Then     MsgBox(0,"Task Completed", "The manual run of the scheduled job completed successfully!")     RunAsWait($Username, $Domain, $Password, 2, 'psexec \\remotemachine -u domain\adminaccount -p passwordgoeshere schtasks /Change /TN "TestTask" /Disable', "C:\Tools\", @SW_HIDE) ElseIf $PID <> 0 Then     MsgBox(16, "Error", "The command you were trying to run failed, please contact a System Administrator.") EndIf EndFunc ;==>_TestJob ;;;;;;;;;;;End Test Functions;;;;;;;;;;;

There you have it, I'm using psexec to do the majority of my automation and I have to use RunAsWait because I'm creating a tool that only a certain department will have access to and they don't have the elevated rights to run psexec on these servers.

 

Also just because it's referenced in the code above the function I call for the message box:  MsgBox(0,"Task Completed", _TestArray()) is the below function.

Func _TestArray() ; Read into an aray and then just extrat the line we want     $iBegin = TimerInit()     $iCount = _FileCountLines($LFileT)     $lastSline = FileReadLine($LFileT, $iCount - 1)     ConsoleWrite(TimerDiff($iBegin) & @CRLF)     Return $lastSline EndFunc

So far the only ideas I have to get the true result of when the scheduled task finishes is to leverage the scheduled tasks query command as follows schtasks /query /fo list /tn "TaskNameHere" > logname.log

and then loop search the log file until the task doesn't show a status of running.

 

Any ideas or thoughts any of you may have or possibly even some example code would go a long way in helping me finally complete this lengthy automation script I've been working on. Our goal is to get these tasks off the responsibility of the systems team and allow the department that's always requesting the tasks to run them directly without actually having to delegate them permissions on the servers. Also this is the first real AutoIt script I've ever wrote besides a few test example scripts. I've been using this project as a learning experience for scripting in AutoIt.


Move email to another folder in Outlook

$
0
0

Hello,

I'm trying to do some work using the Outlook UDF. I can't figure out how to move email which I have just sent from the sent folder to another folder which I have created.

As you can guess, I'm no expert so please bear with me.

Here's my code

Global $oOutlook = _OL_Open() $oItem = _OL_Wrapper_SendMail($oOutlook, "blahblah@outlook.com", "", "", "New Requisition", "") _OL_ItemMove($oOutlook, $oItem, "*\Sent Items", "*\Requisitions\1. Submitted")

when i run it falls over with this error message

 

"C:\Program Files\AutoIt3\Include\OutlookEX.au3" (3125) : ==> Variable must be of type "Object".:
If $oSourceFolder.DefaultItemType <> $vTargetFolder.DefaultItemType Then Return SetError(2, 0, 0)
If $oSourceFolder^ ERROR
 
Thanks  :wacko:

PsExec.exe not working from AU3 script

$
0
0

I am trying to push execution of an EXE on a set of machines on my network.  I am probably missing something simple, but I cannot make the code below work.

  1. PushIt("testpc")
  2.  
  3. Func PushIt($pcname)
  4.     $executor = @ComSpec & " /c " & @ScriptDir & "\PsExec.exe \\" & $pcname & " -s -d C:\Windows\apptopush.exe"
  5.     If Ping($pcname, 2000) = 0 Then Return 0
  6.     If Not FileCopy("apptopush.exe", "\\" & $pcname & "\c$\Windows\", 1) Then Return 0
  7.     RunWait($executor, @SW_SHOW)
  8.     ConsoleWrite($executor & @CRLF)
  9.     Return 1
  10. EndFunc   ;==>PushIt

I have full admin rights on all of the local PCs, including the 'testpc', so this is running with my domain credentials.

When I run it, the exe copies to the remote system, but the exe never executes on the remote system.

If I copy the command from the console, and paste it into a CMD shell from the script path, it runs the exe on the remote, no problem.

 

What am I missing?

 

CCleaner daily routine

$
0
0

Hello,

Im trying to make program for pc cleaning over night.

Basicaly script should run 3 programs, when 1st finish work other start.

So my programs is Avira(scan pc),Ultradefragmenter(hdd defragmentation) and ccleaner (repairs registry and clean junk files)

ccleaner have some magic :alien:

I can't navigate ccleaner, or do anythink.just start

I searched examples but it didnt helped for ccleaner v 5.02.5101

also tried autoit  recording

 

In code comments in my native language but works like that, select program, and with green button all starts.

result: opens ccleaner->nothing heppening

Solutions?

AutoIt         
#include <GUIConstantsEx.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <SendMessage.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> Meniu() Func Meniu()     ; Create a GUI with various controls.     Local $hGUI = GUICreate("Programos kompiuterio tvarkymui")     ; Display the GUI. GUICtrlCreateLabel("Pasirinkti programas is Programfiles", 130, 10)     GUISetState(@SW_SHOW, $hGUI)     Local $idCCfile = GUICtrlCreateButton("CCleaner", 10, 30, 100, 25)   ; GUICtrlCreateProgress(120, 30, 200, 20, $PBS_MARQUEE)   ; _SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50)   GUICtrlCreateLabel("Pasirinkite iseiti arba Pradeti", 130, 75)   Local $idOK = GUICtrlCreateButton("Iseiti", 10,100, 100, 60)   GUICtrlSetBkColor($idOK , 0xFF0000) ;raudonas     Local $idUltraDefragmenter = GUICtrlCreateButton("UltraDefragmenter", 120, 30, 100, 25)     ;   GUICtrlCreateProgress(120, 55, 200, 20, $PBS_MARQUEE)  ;  _SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50)     Local $idAvira = GUICtrlCreateButton("Avira", 240,30, 100, 25)     ;   GUICtrlCreateProgress(120, 90, 200, 20, $PBS_MARQUEE)  ;  _SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50)  Local $idStart = GUICtrlCreateButton("Pradeti", 240, 100, 100, 60) GUICtrlSetBkColor($idStart, 0x33FF00    ) ;green   While 1      Switch GUIGetMsg()      Case $idCCfile          Local Const $sMessage = "Pasirinkite programa CCleaner"          Local $sFileOpenDialog = FileOpenDialog($sMessage, @ProgramFilesDir & "\", "Programos (*.exe)", $FD_FILEMUSTEXIST + $FD_MULTISELECT)          If @error Then         ; Display the error message.         MsgBox($MB_SYSTEMMODAL, "", "CCleaner nebuvo pasirinktas")         ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder.         FileChangeDir(@ScriptDir)       Else         ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder.         FileChangeDir(@ScriptDir)         ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog.         $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF)         ; Display the list of selected files.         MsgBox($MB_SYSTEMMODAL, "", "Tikekimes jus is tikruju pasirinkote CCleaner" & @CRLF & $sFileOpenDialog)       EndIf          Case $idUltraDefragmenter              Msgbox(0,"2","2")          Case $idAvira              Msgbox(0,"3","3")           Case $idStart             global $CCfile = $sFileOpenDialog             Call("Start")          Case $idOK              exit     EndSwitch  WEnd     GUIDelete($hGUI)  EndFunc   ;==>Example Func Start() run ($CCfile) sleep(1000) ;ccleaner lazy code EndFunc

FileCopy path error

$
0
0

Hello again everyone, I have another issue I was hoping someone could point out what I did wrong because I have no clue at this point. The part that is giving me trouble is just a FileCopy command but it says it cannot find the path. My only speculation is that the path is to long but I don't know. Here is what I have an it works.

 

*Note: I had to do some sanitizing so it's not word for word but still should work. Also, I've been using msgbox to verify that the path being used is what I expect it to be.

Case $msg = $CheckListSetup         $ServerName = InputBox("Server Name", "What is the name of your server?")         $Location = StringLeft($ServerName, 3)         MsgBox(0,"","\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm \\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)         if $Location = "aaa" Then            FileCopy("\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm", "\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)

And when I go one folder deeper it stops working:

Case $msg = $CheckListSetup         $ServerName = InputBox("Server Name", "What is the name of your server?")         $Location = StringLeft($ServerName, 3)         MsgBox(0,"","\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm \\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & "\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)         if $Location = "aaa" Then            FileCopy("\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm", "\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & "\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)

Thank you for your time.

High CPU usage when compiling script uses Fileinstall function

$
0
0

I have this simple script which suppose to run two files once compiled

AutoIt         
#NoTrayIcon FileInstall("MyApp.exe", @TempDir &"\MyApp.exe", 1) RunWait(@ComSpec & ' /c ' & @TempDir &"\MyApp.exe" , @TempDir, @SW_MAXIMIZE) Global $stri ="JyB+RVhFfgonIFRWcVFBQU1BQUFBRUFBQUEvLzhBQUxnQUFBQUFBQUFBUUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQonIEFBQUFBQUFBOEFBQUFBNGZ1ZzRBdEFu" & _ "TkliZ0JUTTBoVkdocGN5QndjbTluY21GdElHTmhibTV2ZENCaVpTQnlkVzRnYVc0ZwonIFJF" & _ "OVRJRzF2WkdVdURRMEtKQUFBQUFBQUFBQ2J3Mkl6MzZJTVlOK2lER0Rmb2d4Z1RPeVVZTjZp" & _ "REdERVA2ZGc1cUlNWU1RLwonIHBtQnNvZ3hnMXRxZllNYWlER0Rmb2cxZ082SU1ZTVEvbzJE" & _ "R29neGd4RCtTWU1XaURHREVQNVpnM3FJTVlOK2ltMkRlb2d4ZwonIHhEK1JZTjZpREdCU2FX" & _ "Tm8zNklNWUFBQUFBQUFBQUFBVUVVQUFFd0JCQUFCdXlWUEFBQUFBQUFBQUFEZ0FDTUJDd0VL" & _ "QUFEMgonIEFRQUFmQUlBQUFBQUFFMzhBQUFBRUFBQUFCQUNBQUFBUUFBQUVBQUFBQUlBQUFV" & _ "QUFBQUFBQUFBQlFBQUFBQUFBQUFBMEFVQQonIEFBUUFBSEZ5QlFBQ0FBQ0JBQUFRQUFBUUFB" & _ "QUFBQkFBQUJBQUFBQUFBQUFRQUFBQUFBQUFBQUFBQUFBRWZnSUFvQUFBQUFEdwonIEF3Qmcy" & _ "UUVBQUFBQUFBQUFBQUFBZGdRQStCNEFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQQonIEFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUJBQ0FK" & _ "QUNBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQonIEFBQXVkR1Y0ZEFBQUFHejBB" & _ "UUFBRUFBQUFQWUJBQUFFQUFBQUFBQUFBQUFBQUFBQUFBQWdBQUJnTG5Ka1lYUmhBQUNVZkFB" & _ "QQonIEFCQUNBQUIrQUFBQStnRUFBQUFBQUFBQUFBQUFBQUFBUUFBQVFDNWtZWFJoQUFBQVJG" & _ "b0JBQUNRQWdBQUpBQUFBSGdDQUFBQQonIEFBQUFBQUFBQUFBQUFFQUFBTUF1Y25OeVl3QUFB" & _ "R0RaQVFBQThBTUFBTm9CQUFDY0FnQUFBQUFBQUFBQUFBQUFBQUJBQUFCQQonIEFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQQonIEFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQonIEFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQon" & _ "IEFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQQonIEFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQonIEFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQQonIEFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB" & _ "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUdvawonIHVBMzlRUURvZzk0QkFHaGtORUlBalhY" & _ "UTZFY2xBQUNMZFFpRFpmd0FpOWlOZmdpTlJlRG9BU1lBQURQSk9FNG9ENVRCU1lQaAonIDhJ" & _ "UEJJSUhKQUFBQkFGSC9NUDkxRFA4Mi94V0FFa0lBalhYZzZJVWxBQUNOZGREb2ZTVUFBT2pK" & _ "M2dFQXdnZ0FWWXZzdUF3ZwonIEFBRG9DNkFCQUtGMGtFSUFNOFdKUmZoby93OEFBSTJGOU4v" & _ ............................rest of base64 code Global $sFilePath = @TempDir & "\MyApp.txt" if FileExists($sFilePath) Then FileDelete($sFilePath) FileOpen($sFilePath & "\MyApp.txt" , 1) Filewrite($sFilePath, $stri) FileClose($sFilePath & "\MyApp.txt")

I have used FileInstall function to run my application and write the base64 encoded string to a text file in temp folder, but it seems the encoded string length is too long (the script size about 2 Mb)  so when compiling the script using the command :

Aut2Exe.exe /in ScriptName.au3 /out  ScriptName.exe /nopack
the process Aut2exe.exe results in High CPU usage (about 40%-50%) for almost 3 minutes to complete the compiling (MyApp.exe size about 1 Mb only), I guess my base64 code lenght is causing that problem but I can't dispense it So is there any trick to reduce the CPU usage or the time needed to compile a single script ? or maybe there is another way to do the same job instead  of using FileInstall ?!

IE intercepting Ctrl+F find function or invoking Find via GUI

$
0
0

I'm trying to intercept the Ctrl+F function in IE so that I can achieve a similar effect of words being highlighted via the input on my gui. To explain better here is my code.

 

What I want is to basically be able to type stuff into the input box that follows the label "Quick find:" and for any data that partially matches input  on the displayed html page to be highlighted as if I was using Ctrl+F search in IE. You can see the behaviour of Ctrl+F highlight by clicking into the IE object and then pressing Ctrl+F. I would also like for it to auto-scroll to the *best* match data. Essentially same as Ctrl+F in IE.

 

Place all attachments - the tow PNG files and the HTML file in script folder to get the full effect.

 

Chipm, Chimp, Chimp,  <---- just trying to summon user Chimp who seems to have very good knowledge of IE :P

AutoIt         
#include-once #NoTrayIcon #AutoIt3Wrapper_Outfile=Example.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <WinAPIEx.au3> #include <IE.au3> Global $bAero, $hidden = False, $tuck = False, $tucked = False, $untucked = False, $tucking = False, $untucking = False, $timer = 0, $tdiff = 0, _ $LAYERED_GUI = $WS_EX_LAYERED, $hGUI_child, $hGUI_height = 683 Global Const $hDwmApiDll = DllOpen("dwmapi.dll"), $sChkAero = DllStructCreate("int;") DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero)) $bAero = DllStructGetData($sChkAero, 1) If Not $bAero Then     $LAYERED_GUI = 0     $hGUI_height = $hGUI_height - 20 EndIf $hGUI = GUICreate("", 715, $hGUI_height, -1, 0, $WS_POPUP, $LAYERED_GUI + $WS_EX_TOPMOST, WinGetHandle(AutoItWinGetTitle())) $hIcon = _WinAPI_GetClassLongEx($hGUI, $GCL_HICON) _WinAPI_DestroyIcon($hIcon) _WinAPI_SetClassLongEx($hGUI, $GCL_HICON, 0) _WinAPI_SetClassLongEx($hGUI, $GCL_HICONSM, 0) If $bAero Then     $hGUI_child = GUICreate("", 715-39, 683 - 26, 22,  3, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_TOPMOST, $hGUI)     $hGUI_Font = $hGUI_child Else     $hGUI_Font = $hGUI     $hGUI_child = $hGUI EndIf GUISetBkColor(0xFFFFFF) GUISetFont(18, 100, Default, 'Segoe UI', $hGUI_Font, 5) GUICtrlCreateLabel('Quick find:', 10, 25) GUICtrlCreateInput('', 150, 20, 100, 35) $oIE = _IECreateEmbedded() $oIEobj = GUICtrlCreateObj($oIE, 10, 85, 650, 550) $oNav = _IENavigate($oIE, @ScriptDir & '/example.html', 0) $hGUI_child2 = GUICreate("", 112, 50, 280, 645, $WS_POPUP, $LAYERED_GUI + $WS_EX_MDICHILD + $WS_EX_TOPMOST, $hGUI_child) If Not $bAero Then     GUISetBkColor(0xE0F2F7)     $hGUI_Font = $hGUI_child2     GUISetFont(33, 100, Default, 'Segoe UI', $hGUI_Font, 5)     GUICtrlCreateLabel(" = ", 0, 0, 112, 50, $SS_CENTER + $SS_CENTERIMAGE) EndIf GUISetCursor(0, 1, $hGUI_child2) If $bAero Then     _GDIPlus_Startup()     $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\panel.png')     SetBitmap($hGUI, $hImage)     $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\roundbn.png')     SetBitmap($hGUI_child2, $hImage)     _GDIPlus_Shutdown() EndIf GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUISetState(@SW_SHOW, $hGUI) If $bAero Then GUISetState(@SW_SHOW, $hGUI_child) GUISetState(@SW_SHOW, $hGUI_child2) While 1     $mPos = MouseGetPos()     If BitAnd($hidden, $mPos[1] = 0, $timer = 0) Then         $timer = TimerInit()         Sleep(10)     ElseIf $mPos[1] <> 0 Then         $timer = 0         $tdiff = 0     EndIf     If $timer <> 0 Then $tdiff = TimerDiff($timer)     If BitAND($hidden, Not $tucked, $mPos[1] <> 0, Not $tucking) Then         $tuck = True         $untucking = False         $tucking = True         AdlibRegister("TuckAway", 2500)     ElseIf BitAND($hidden, $tucked, $mPos[1] = 0, Not $untucking, $tdiff > 450) Then         $tuck = False         $tucking = False         $untucking = True         AdlibRegister("TuckAway")     ElseIf BitAND($hidden, Not $tucked, $mPos[1] = 0, $tucking) Then         AdlibUnRegister("TuckAway")         $tuck = False         $tucking = False     EndIf     $msg = GUIGetMsg(1)     Switch $msg[1]         Case $hGUI             Switch $msg[0]                 Case $GUI_EVENT_CLOSE, $GUI_EVENT_SECONDARYUP                     Exit             EndSwitch         Case $hGUI_child             Switch $msg[0]                 Case $GUI_EVENT_CLOSE, $GUI_EVENT_SECONDARYUP                     Exit             EndSwitch         Case $hGUI_child2             Switch $msg[0]                 Case $GUI_EVENT_PRIMARYDOWN                     If Not $hidden Then                         HidePanel()                     Else                         HidePanel(False)                     EndIf             EndSwitch     EndSwitch WEnd Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam)     Switch $wParam         Case 0x00780000             $oIE.document.parentwindow.scrollBy(0, -150)         Case 0xFF880000             $oIE.document.parentwindow.scrollBy(0, 150)     EndSwitch     Return $GUI_RUNDEFMSG EndFunc Func HidePanel($hide = True)     AdlibUnRegister("TuckAway")     If $hide Then         $tucked = False         $untucked = True         $hidden = True         For $i = -1 to -663 Step - 1             WinMove($hGUI, "", Default, $i)         Next     Else         $tucked = False         $untucked = False         $hidden = False         For $i = -664 to -4 Step 1             WinMove($hGUI, "", Default, $i)         Next     EndIf EndFunc Func TuckAway()     If $tuck Then         $tucking = False         $untucked = False         $tucked = True         For $i = 663 to 695 Step 1             WinMove($hGUI, "", Default, -$i)             Sleep(10)         Next     Else         $untucking = False         $tucked = False         For $i = 695 to 663 Step - 1             WinMove($hGUI, "", Default, -$i)             Sleep(10)         Next     EndIf     AdlibUnRegister("TuckAway") EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity = 255)     Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend     $hScrDC = _WinAPI_GetDC(0)     $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)     $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)     $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)     $tSize = DllStructCreate($tagSIZE)     $pSize = DllStructGetPtr($tSize)     DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))     DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))     $tSource = DllStructCreate($tagPOINT)     $pSource = DllStructGetPtr($tSource)     $tBlend = DllStructCreate($tagBLENDFUNCTION)     $pBlend = DllStructGetPtr($tBlend)     DllStructSetData($tBlend, "Alpha", $iOpacity)     DllStructSetData($tBlend, "Format", 1)     _WinAPI_UpdateLayeredWindow($hGUI, $hGUI, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)     _WinAPI_ReleaseDC(0, $hScrDC)     _WinAPI_SelectObject($hMemDC, $hOld)     _WinAPI_DeleteObject($hBitmap)     _WinAPI_DeleteDC($hMemDC) EndFunc

Attached Thumbnails

  • panel.png
  • roundbn.png

Attached Files

Where i can get the SciTE4 AutoIt3 's icon

$
0
0

Hi all,

Where i can get the SciTE4 AutoIt3 's icon ? 


Checking folder for files if empty then crash

$
0
0

Hi,

 

i have problem, i started using an array for checking files in a folder and adding them to a combobox.

But if the folder is empty then my script crashes, i tried to check the array with:

                    $NAME   = GUICtrlRead($AFDELINGLIST)                     $VAR    = IniRead("P:\Afdelingen\afdelingen.ini", "names", $NAME, "")                 GUICtrlSetState($SOFTWARE, $GUI_ENABLE)                 GUICtrlSetData($SOFTWARE, "")                 GUICtrlSetData($SOFTWARE, "Geen installatie bestanden")                 GUICtrlSetData($SOFTWARE, "================================================")                     Local $FileList = _FileListToArray("P:\Software\Afdelingen\" & $VAR & "\", "*.*", $FLTA_FILES)                         For $i = 1 To $FileList[0]                             If $i <> "" Then                                 GUICtrlSetData($SOFTWARE, $FileList[$i])                             EndIf                         Next

But when i run my script and i get to the point where it reads the ini file (checked the values comming from that with msgbox, they are good), after that it should go to the array but then it crashes if the folder is empty, if i add a file the array works. 

 

How can i catch this error?

loop never end even if true

$
0
0

Hi All could plesae guide what is wrong in the below script

 

the folloowing script never ends even the object is set to true. do i need to modify anything on below script

 

 

While (ControlCommand("Documents - odeeqa@slc07ivz.us.oracle.com - WinSCP","","[CLASS:TDirView; INSTANCE:1]","Is Visible", ""))<>1
 
MsgBox(1,"",ControlFocus("Documents - odeeqa@slc07ivz.us.oracle.com - WinSCP","","[CLASS:TDirView; INSTANCE:1]"))
 WEnd

Send("{alt}")

$FT_CREATED and $FT_ACCESSED

$
0
0

Hello everyone,

In this topic

 

http://www.autoitscript.com/forum/topic/143676-list-files-in-folders-and-subfolders-quickly/

 

I found a code (Belini member) that searches files in a very fast

AutoIt         
#include <String.au3> #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> global $listing $directory = @DesktopDir list($directory, 0) time() Func list($path = "", $counter = 0) $counter = 0 $path &= '\' Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*') If $demand_file = -1 Then Return '' While 1   $file = FileFindNextFile($demand_file)   If @error Then ExitLoop   If @extended Then    If $counter >= 10 Then ContinueLoop    list($path & $file, $counter + 1 )   Else             $listing &= $path & $file & "|"   EndIf WEnd FileClose($demand_file) EndFunc func time() $listing = StringTrimRight($listing, 1) $listing = _StringExplode($listing, "|", 0) _ArraySort($listing) ;_ArrayDisplay($listing, "File") _FileCreate(@ScriptDir & "\result.txt") _FileWriteFromArray(@ScriptDir & "\result.txt",$listing) endfunc

I can not understand
the function
where add

FileSetTime

$FT_CREATED $FT_ACCESSED

     $aTime_Mod = FileGetTime($sFile, $FT_MODIFIED)          $aTime_Created = FileGetTime($sFile, $FT_CREATED)          $aResult[$i][1] = $aTime_Mod[0] & "/" & $aTime_Mod[1] & "/" & $aTime_Mod[2] & " [" & $aTime_Mod[3] & ":" & $aTime_Mod[4] & ":" & $aTime_Mod[5] & "]"      $aResult[$i][2] = $aTime_Created[0] & "/" & $aTime_Created[1] & "/" & $aTime_Created[2] & " [" & $aTime_Created[3] & ":" & $aTime_Created[4] & ":" & $aTime_Created[5] & "]"

I think that the right function is $list_files
maybe within FOR - NEXT?

 

thanks

Label set with $WS_EX_TOPMOST and $GUI_ONTOP is hidden when I mouse over control.

$
0
0

I have a button over top of which I want to sometimes place a label.  I set the label's extended style to $WS_EX_TOPMOST.  However, the problem is when I hover over that button, the label is then hidden behind the button.  This seems counter intuitive.

 

Is this an issue with Autoit or something I'm doing wrong?  Is there a workaround?  Finally, should this be reported as a bug?

AutoIt         
  1. #include <GuiConstantsEx.au3>
  2. #include <StaticConstants.au3>
  3. #include <WindowsConstants.au3>
  4.  
  5. Const $SIZENWSE = 12
  6.  
  7. GUICreate("Repro")
  8.  
  9. GUICtrlCreateButton("Hover Over Me!", 10, 10, 90, 90)
  10.  
  11. Const $h_box = GuiCtrlCreateLabel('', 8, 8, 15, 15, $SS_BLACKRECT, $WS_EX_TOPMOST)
  12.  
  13. GUICtrlSetState($h_box, $GUI_ONTOP)
  14.  
  15. GuiCtrlSetCursor($h_box, $SIZENWSE)
  16.  
  17.  
  18.     Switch GUIGetMsg()            
  19.         Case $GUI_EVENT_CLOSE
  20.             Exit
  21.     EndSwitch

Edit: latest beta on Windows 7 x64.

On Compiling Script Wrong Windows Icon Attached to Generated 'exe' File

$
0
0

OS = WinXP

 

Hi,

 

I had a slightly older copy of AutoIt. When I used to compile script I would get a standard AutoIt icon attached to the 'exe' file that the compiler would generate; so in Windows this icon would be like a blue circle with white triangle inside it. Fine.

 

However, something happened to this and now the icon looks more like a small image of a browser window - not the standard AutoIt icon. To try to fix this I installed the latest version of AutoIt - v3.3.12.0. After installing that version and then recompliling what scripts I had I still find that I don't get the standard AutoIt icon on the resulting 'exe' files (I get the browser-like icon mentioned above).

 

Does anyone know how I can fix this - how do I get the standard AutoIt icon back when I compile a script to an exe file.

Viewing all 12506 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>