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

Please help me in Renaming a file and extension

$
0
0

Hi Everyone, 

 

I have 2 queries, please assist,

 

1. Rename a file:

 

I have a file in C:\Temp\GLW123.tmp 

I need to rename the file to Setup.wse  and the file should be placed in the same directory C:\temp\

 

2. Embedding a .VBS file within the autoScript complied EXE.

 

i can achieve the above renaming functionality  using below VBS. 

SearchFileName = "GLW123.tmp"               
RenameFileTo   = "SETUP.WSE"
For each file In folder1.Files    
    'WScript.Echo (file.Name)
    If instr(file.name, searchFileName) = 1 Then
         file.name = renameFileTo
           Exit For
    End If
Next
 
is there any option to embed this VBS inside the EXE and use the VBS in my autoit script.
 
Please Help.
 

Get state of ListViewItem checked or not ($LVS_EX_CHECKBOXES)

$
0
0

I guys!

 

I have an simple listview control with exstyle ($LVS_EX_CHECKBOXES) and i need get item state (Checked or not).

 

I tried:
 
$r = GUICtrlSendMsg($LVI1, $LVM_GETITEMSTATE, 1, $LVIS_SELECTED) $r2 = GUICtrlRead($LVI1) GUICtrlSetState($LVI1,$GUI_CHECKED) MsgBox(0,"", $r & "|" & $r2)
 

With and without guictrlsetstate but return same result if checked or not.

 

Guictrlsetstate is working fine!

 

I trying without include listview native udf

 

my listview code:

$ListView1 = GUICtrlCreateListView("Software|Instalador|Comando", 16, 32, 585, 337,-1,BitOR($LVS_EX_CHECKBOXES,$LVS_EX_GRIDLINES))

WinWait and ControlClick

$
0
0

I am attempting to write my first AutoIt script to detect when a window is present and then click the OK button. Testing has been difficult so I'm looking for some validation of my code from the experts. Am I doing it right?

 

 

Screenshot of window

Logoff.gif

 

 

Window Info

>>>> Window <<<<
Title: SIEMENS Soarian® Automatic Logoff -- Webpage Dialog
Class: Internet Explorer_TridentDlgFrame
Position: 665, 450
Size: 356, 152
Style: 0x96C80000
ExStyle: 0x00000101
Handle: 0x00DA0706
 
>>>> Control <<<<
Class: Internet Explorer_Server
Instance: 1
ClassnameNN: Internet Explorer_Server1
Name:
Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1]
ID:
Text:
Position: 0, 0
Size: 350, 120
ControlClick Coords: 281, 62
Style: 0x56000000
ExStyle: 0x00000000
Handle: 0x0080078C
 
>>>> Mouse <<<<
Position: 949, 541
Cursor ID: 0
Color: 0xE8EFFA
 
>>>> StatusBar <<<<
 
>>>> ToolsBar <<<<
 
>>>> Visible Text <<<<
 
 
>>>> Hidden Text <<<<
 
 
Code
#NoTrayIcon
#include <IE.au3>
 
; Wait for logoff window, then click on OK
WinWait("SIEMENS Soarian® Automatic Logoff -- Webpage Dialog")
ControlClick("SIEMENS Soarian® Automatic Logoff -- Webpage Dialog", "", "[CLASS:Button; TEXT:OK; Instance:1;]")

 

_ExcelReadtoArray reading oddly. Any way to force it to copy literal Strings instead?

$
0
0

Hello.

 

I am copying a page from one Excel file to another. I've decided to use _ExcelReadToArray and _ExcelWriteFromArray to get the large, dynamic page's data from one file to the other. The only problem with this is that the _ExcelReadToArray has a problem with dates in the format MM/DD/YYYY. Instead of 11/10/2013, the array contains "2013111000000" (yes, with all those zeroes) after the array is filled by the call. Then, when I write the array to the other file, it evaluates the "/" as a divides and I get a similar number with an "E-8" on it.
Is there any way to make the reading and writing assume that they are just pure strings and not have it (or excel) evaluate the contents?

Thanks ahead of time!




PS here is some sample code from the section with the reading/writing:

$rcaTATreport = _ExcelBookOpen($RCAfolder & $sTATreport) $macroSheet = _ExcelBookOpen($pathToCurrentWeek & $sMacroSheet) ;copy the "RCA lists" tab to an array $rcaTATreport.Sheets("RCA List").Select Local $aArray = _ExcelReadSheetToArray($rcaTATreport, 1) ;Starts at first row for headers ;Display the value of R2C14 aka N2, to see if contents are being read as strings or evaluated MsgBox(0, "", "Contents of Array at N2: " & ($aArray[2][14]) ) ;Delete "RCA List" from macroSheet, and then create a new (blank) one _ExcelSheetDelete($macroSheet, "RCA List") ;Delete Sheet by string name of SheetName _ExcelSheetAddNew($macroSheet, "RCA List")  ;Creates a new sheet with name "RCA List" ;Select "RCA List and then copy the contents of the array to it. $macroSheet.Sheets("RCA List").Select _ExcelWriteSheetFromArray($macroSheet, $aArray)

RDC Black Screen in AutoIT

$
0
0

Ok, so if I use TeamViewer to remote into a computer, autoit does not run correctly... I haven't the time right now to debug this.

 

If however I remote in using windows(7) Remote Desktop Connection software... it does.

 

But I need to hide the screen as I'm working on the remote pc because its outputting to a HUGE monitor on the factory floor and the higher-ups dont want the employees seeing all the bs on it... blah blah blah whatever, anyways...

 

Is there anyway to do this? maybe turn off the monitor?I'm not sure how TeamViewer does this actually....

 

 

... any ideas??

Newbie needs assistance with Java and Win7

$
0
0

All,

 

I am no programmer or script writer however willing and trying to learn. I have been tasked with finding a script to add to a list of on going code that will determine the correct or current version of Java installed on multiple platforms in a corporate enterprise environment. We are using xp and win7 and what has been determined with what the current code provides us is inconsistent. I have found several other post regarding this but need some good complete code that works. What we have found is when running the current code the version of java do not match from system32 to the wow6432node. We would like these to be consistent. The script would need to determine the current version/s and allow us push the correct version a java 7.x as needed from a login script. I hope this makes some sense as I may have even confused myself. Any assistance or a direction would be absolutely appreciated.

 

Thanks in advance,

Netcruzn

Get listview rows (Diagonal size)

$
0
0

I made this func to check uncheck all checkboxes in a listview but i want more optimized to no need specifi the size

Func _CheckAllLV($_iCB,$_iLV,$_sSize) If GUICtrlGetHandle($_iLV) <> 0 Then If GUICtrlRead($_iCB) = 1 Then For $i = 1 to $_sSize _GUICtrlListView_SetItemChecked($_iLV,$i-1, True) Next ElseIf GUICtrlRead($_iCB) = 4 Then For $i = 1 to $_sSize _GUICtrlListView_SetItemChecked($_iLV,$i-1, False) Next EndIf EndIf EndFunc;_CheckAllLV

I think i found.

 

_GUICtrlListView_GetItemCount. Thanks

Need help creating an array.

$
0
0

I have been tasked with renaming the same filename located  in the same path on several hosts. I have already created the script that will rename using Filemove.

 

I now need to understand how I can I create an array,  that can store each line of a text file or excel column that  displays the hostname as a variable and run the script to rename it . Sorry for such a basic request but I am fairly new to this. I have attempted to look at some of the examples for Arrays but just couldn't grasp what I need to do in this exact scenario.


Second opinion on false-positive

$
0
0
  1. TraySetIcon(@ScriptDir&"\icon.ico")
  2.     if WinExists("Google Notification") Then
  3.         SoundPlay("C:\R2D2-yeah.wav")
  4.         Sleep(10000)
  5.     EndIf

So I wrote this piece of code and saved it and compile it under mail_notification_check.exe.

 

I ran it for about a day; when I re-run it at a point Spybot S&D identified the compiled the script as Trojan.Bancos.prx.

 

Saving it under a different name , r2d2mail.exe didn't trigger the Spybot S&D warning; Avast didn't detect it at all, even after deep scanning it.

 

By the looks of it, it's clearly a false-positive, triggered by the name of the script ( I tried with mail.exe and notmail.exe and they were detected as well); but a second opinion would be very much appreciated.

 

Regards,

 

 

 

script to Copy file to the E:\temp folder

$
0
0

I just want to make a script to Copy file to the E:\temp folder.

 

However the following script doesn't work. I tested the DirCreate command and it is working and creating the folder.

However copyfile doesn't work. It returns 0. How do I catch the runtime error and display it? I tried below method to catch the error but I don't get any msgbox displaying the error.

My code is pasted below:

 

#include-once
#include <File.au3>
#include <WinAPI.au3>
Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
$SRC = "" ;set the variable to nothing, string data
$DST = 0 ; sets it to 0

$SRC = GetExplorerSelection();
;MSgbox(0,"file",GetExplorerSelection())
;if $SRC = "" then exit ;makes sure that there is data in the the variable before continuing
;$DST = "E:\temp\" ;FileSelectFolder("Please Select Backup DESTINATION","") ;user prompt to select a destination
;MSgbox(0,"The SOURCE folder", $src)
;MSgbox(0,"The Destination folder", $DST,1)
$i = FileChangeDir("E:\temp")
MsgBox(0,"",$i & "-" & @WorkingDir)
;#RequireAdmin
$x = FileCopy($SRC,@WorkingDir,1)
MsgBox(0,"",$x & "-" & @WorkingDir & $src)
If @error Then MsgBox(48 + 262144, "COM Error", "@error is set to COM error number." & @CRLF & "@error = " & @error)
$x = DirCreate("E:\SAMPLE")
;MyErrFunc($x)
;#RequireAdmin
DirCreate("E:\SAMPL")
;#RequireAdmin
FileCopy($SRC,"E:\SAMPL\permit.txt",1)
#forceref $oMyError
Func MyErrFunc($oMyError)
    Local $HexNumber
Local $strMsg

$HexNumber = Hex($oMyError.Number, 8)
$strMsg = "Error Number: " & $HexNumber & @CRLF
$strMsg &= "WinDescription: " & $oMyError.WinDescription & @CRLF
$strMsg &= "Script Line: " & $oMyError.ScriptLine & @CRLF
MsgBox(0, "ERROR", $strMsg)
SetError(1)
Endfunc
; ===============================================================================================================================
Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

Func GetExplorerSelection()
Local $saveClip = ""
$filesFolders = ""
Local $handle = _WinAPI_GetForegroundWindow()
_WinWaitActivate("[CLASS:CabinetWClass]","")
;msgbox(0,"Handle",$handle)
Local $className = _WinAPI_GetClassName($handle)
;msgbox(0,"className",$className)
If $className = "ExploreWClass" Or $className = "CabinetWClass" Then
$saveClip = ClipGet()
Send("^c")
;msgbox(0,"IN",ClipGet())
Sleep(50) ; give clipboard time to react
$filesFolders = ClipGet()
ClipPut($saveClip)
; test if $filesFolders contains @LF and split if so etc..
; code to call StringSplit() etc..
EndIf
Return $filesFolders
EndFunc
 

buy air jordans online jordan 3 cement 33073

$
0
0
thousand words and that is the driver behind Thumbnails. For air jordan 10 steel
diminish the possible return for him now. 7pound gold bar. I jordan 10 steel
final installment of the original holy trilogy. jordan 10 steel
quickly to the people most effected and, he said, do so in steel 10s
percent among avid fans from 2011 to 2012.. steel 10s
in order to achieve the best.. Jim, 58, a detective steel 10s
vary on the technique they use, but the point stands that air jordan 10 steel
a day, and also to pay for the live music, also 200 a day, bel air 5s

Exit the script if user input is null - Please assist

$
0
0

Hello Everyone,

 

Am struck with the below scenario, 

 

$EXEpath = FileOpenDialog('Please choose any file', '', 'All (*.*)', 1)  ---> This will open a window to select for a file. 

 

if $EXEpath <> 0 Then     (This Not equal to is not working)

       ;;"User has selected a file, Continue with script"

Else

     ;;"User did not select any file, exiting"

 

EndIf

 

 

If user does not select any file and clicks on cancel after the opening Choose a file dialog (please refer the attachment) my script should exit else have to proceed with scripting

 

Please help.

Attached Thumbnails

  • Choose_File.jpg

What logic to use

$
0
0

Hi All,

 

Let us say:

 

$V = "5.6.7.8"

 

$M = "current version is 5.6.7.8"

 

One way to compare both is

 

"current version is" & $V == $M

and my test will get pass

 

--------

But i just want to make it more generic, I do not want to concatenate "current version is" with $V.

is there some other way that if i can use some regular expressions in place of "current version is" if yes please elborate how

 

Thanks

 

How can i convert this code to autoit?

$
0
0

How can i convert this code to autoit?

I shall be very thankful to you.

If Not Me.AllUsersPhoneBook.Entries.Contains(EntryName) Then     Dim entry As RasEntry = RasEntry.CreateDialUpEntry(EntryName, PhoneNumber, RasDevice.GetDeviceByName("(PPPOE)", RasDeviceType.PPPoE)     Me.AllUsersPhoneBook.Entries.Add(entry) End If

How to use special characters inside tha mail

$
0
0

Hi All,

 

I want to use special charaters inside the subject of any composed mail using outlook

 

Suppose i want to use "&!@#$%^&*<>?*" as subject but what's happning is that these special charaters are not getting pasted in the subject text area

Instead browser is getting opened when this event takes place. i think autoit is reading these special charaters as some other command or anything else

 

However instad of special charaters if i use simple letters like "test mail" then it is working fine.

 

Can you please suggest how can i use these special charaters as simple string

 


_ispressed help please

$
0
0

Hello,

here's what i'm trying to do:

 

as long as left/primary mouse button is pressed keep clicking the left/primary mousebutton.

here's what i got so far:

#include <misc.au3> $dll = DllOpen("user32.dll") HotKeySet ("{esc}","stop") While 1     if _IsPressed ("01") Then         MouseClick("primary")     EndIf WEnd func stop ()     Exit     EndFunc

i tried changing the amound of click mouseclick does but that doesn't really solve anything

 

what happens is that it clicks once/twice and then it stops.

 

 

 

 

 

 

the other thing i tried was:

#include <misc.au3> $dll = DllOpen("user32.dll") HotKeySet ("{esc}","stop") While 1     if _IsPressed ("01") Then         MouseDown("primary")     EndIf WEnd func stop ()     Exit     EndFunc

while it sometimes does register like 500 clicks being sent a second (o.o)   it does not allways work.

any help would be appreciated,

thanks.

 

dg.

Send image through multipart/form-data POST request

$
0
0
Hello, 
 
I'm trying to automate a form submission (http://prodavalnik.com/adding/). It's multipart/form-data POST request.
 
There is no problem when submitting it through POSTMAN Chrome extention. What I want is to make it fully automate so I tried to write it on Autoit. 
 I've succeded submitting the form without image data attached. Seems like encoding of the image is not as server expects. Tried different ways, but for the moment i can't upload image through this form automation. 

 

Here is a sample from the code: 

AutoIt         
Func HttpPost($sURL, $sData = "", $sCookie = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0)  $oHTTP.SetRequestHeader("Host", "prodavalnik.com")  $oHTTP.SetRequestHeader("Content-Type", "multipart/form-data; boundary=----xxx") $oHTTP.SetRequestHeader("Cookie", $sCookie) $oHTTP.Send($sData) If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) ;Logg($oHTTP.ResponseText) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Func SendAd($multipartFileName, $imageFileName) Local $multipartFile = FileOpen($multipartFileName, 128) Local $imageFile = FileOpen($imageFileName, 16) Local $postData = FileRead($multipartFile) & @CRLF & @CRLF & FileRead($imageFile) & @CRLF & "------xxx--" HttpPost("http://prodavalnik.com/adding/", $postData, "PHPSESSID=xxx") FileClose($multipartFile) FileClose($imageFile) EndFunc SendAd("test.txt", "test.jpg")

Sorry for the awful english. 

Log file help

$
0
0
Hi all I want to do a keylogger and the file. Log to send me mail .. PLS HELP !

<snip>

string replacement error

$
0
0

ok i have a rather large database and i wanted to clean it up a little (remove the unneeded html)

 

so i wipped to gether a little prog to do it for me as the database has 53000 sections alone never mind the keys for each section

 

the script i wrote should basicly;

 

read the string, find the text inbetween said html

replace that text,

then replace the said html

then rewrite to the ini file

 

EG

piece of data

 

[winnable]
1= Possible to win or achieve: <span class="illustration">a winnable election campaign; winnable games.</span>
2= capable of being won: <span class="illustration"> a winnable war.</span>

 

string  = Possible to win or achieve: <span class="illustration">a winnable election campaign; winnable games.</span>

 

after first replace

 

string  = Possible to win or achieve: <span</span>

 

after second replace


string = Possible to win or achieve:

 

new data

 

[winnable]
1= Possible to win or achieve:
2= capable of being won: <span class="illustration"> a winnable war.</span>

 

however it is returning like this

 

[winnable]
1=
2= capable of being won: <span class="illustration"> a winnable war.</span>

 

any chance a second pair of eyes could help me ?

Plain Text         
#include <Array.au3> #Include <String.au3> $ini = "data.ini" $secnames = IniReadSectionNames ($ini) For $i = 1 To $secnames[0] step 1         $key = IniReadSection($ini,$secnames[$i])             for $p = 1 To $key[0][0] step 1                 $sb = _StringBetween($key[$p][1],'<span', '</span>')                 For $x = 0 to UBound($sb) - 1 step 1                     $key1 = StringReplace($key,$sb[$x],"")                     $key2 = StringReplace($key1,"<span","")                     $key3 = StringReplace($key2,"</span>","")                     IniWrite($ini,$secnames[$i],$key[$p][0],$key3)                 next             Next     Next

like? transform this code to autoit

$
0
0

I would like to tranform this code I found on the web autoit
It is written in batch, and the truth is very good and practical
If anyone has any idea I leave the code
Sorry for my bad English

Plain Text         
@echo off setlocal enableextensions enabledelayedexpansion color 17 title Java removal/update tool v0.9 echo. echo This software is brought to you by Grintor. echo ^<Grintor at Gmail dot Com^> echo. echo This program is free software. echo This program IS PROVIDED WITHOUT WARRANTY, EITHER EXPRESSED OR IMPLIED. echo This program is copyrighted under the terms of GPLv3: echo see ^<http://www.gnu.org/licenses/^>. echo. echo This program uses cURL, also free software, source code available: echo see ^<http://curl.haxx.se/^>. echo. echo This binary is also a compressed package. echo The source code is available within. echo It can be decompressed using 7-zip, also free software: echo see ^<http://www.7-zip.org/^>. echo. FOR /L %%n IN (1,1,10) DO ping -n 2 127.0.0.1 > nul & <nul set /p =. cls echo. echo Searching for latest version of Java... ping -n 1 google.com > nul || goto error ::----------- Find the latest java version---------------------------------- FOR /F "tokens=2 delims=<> " %%n IN ('curl.exe -s -L http://javadl-esd.sun.com/update/1.7.0/map-m-1.7.0.xml ^| find /i "https:"') DO set URL1=%%n FOR /F "tokens=2 delims=<> " %%n IN ('curl.exe -s -L -k %URL1% ^| find /i "<version>"') DO set RemoteJavaVersion=%%n set RemoteJavaVersion=%RemoteJavaVersion:~0,8% echo The latest version of java is %RemoteJavaVersion%. ::----------- Find the local Java version----------------------------------- set LocalJavaVersion=None FOR /F "tokens=1-15" %%n IN ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s ^& reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall /s 2^> nul') DO (    if '%%n'=='InstallSource' (      set p=%%p%%q%%r%%s%%t%%u%%v%%w%%x%%y%%z      set p=!p: =\!      set p=!p:\= !      for %%n in (!p!) do set c=%%n    )    if '%%n'=='DisplayName' (       set p=%%p       if "!p:~0,4!"=="Java" if not "%%q"=="Auto" if not '!LocalJavaVersion!'=='None' (set LocalJavaVersion=Multi) ELSE (set LocalJavaVersion=!c:~3!)       if "!p:~0,4!"=="J2SE" if not '!LocalJavaVersion!'=='None' (set LocalJavaVersion=Multi) ELSE (set LocalJavaVersion=!c:~3!)    ) ) if '%LocalJavaVersion%'=='None' echo There is no local version of Java. & goto install if '%LocalJavaVersion%'=='Multi' echo There are multiple local versions of Java installed. & goto uninstall echo The local version of Java is %LocalJavaVersion%. ::----------- If they match, skip to the end--------------------------------- if '%RemoteJavaVersion%'=='%LocalJavaVersion%' (goto finished) ELSE (echo The Local version of Java is out of date.) ::----------- Uninstall all currently installed java versions---------------- :uninstall if '%LocalJavaVersion%'=='Multi' (echo Uninstalling all local versions of Java...) ELSE (echo Uninstalling the local version of Java...) FOR /F "tokens=1-4" %%n IN ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s ^& reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall /s 2^> nul') DO (    if '%%n'=='UninstallString' (      set c=%%q      set c=!c:/I=/X!    )    if '%%n'=='DisplayName' (       set d=%%p       if "!d:~0,4!"=="Java" if not "%%q"=="Auto" msiexec.exe !c! /qn & ping -n 11 127.0.0.1 > nul       if "!d:~0,4!"=="J2SE" msiexec.exe !c! /qn & ping -n 11 127.0.0.1 > nul    ) ) ::----------- Download the latest java, install, delete the installer.------- :install echo Downloading latest version of Java... FOR /F "tokens=2 delims=<> " %%n IN ('curl.exe -s -L -k %url1% ^| find /i ".exe"') DO set url2=%%n curl.exe -s -L -k -o java.exe %url2% echo Installing latest version of Java... start /wait java.exe /s ping 127.0.0.1 > nul del java.exe ::----------- Up to date ---------------------------------------------------- :finished echo Your Java is up to date. echo. ::----------- There was an error--------------------------------------------- goto noerror :error echo There was a network error. Please try again. :noerror FOR /L %%n IN (1,1,10) DO ping -n 2 127.0.0.1 > nul & <nul set /p =.

http://downloads.sourceforge.net/project/autojavaupdater/java%20tool.exe?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fautojavaupdater%2F&ts=1385042371&use_mirror=ufpr

Viewing all 12506 articles
Browse latest View live


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