
JCEF
Active Members-
Posts
25 -
Joined
-
Last visited
Profile Information
-
Location
Portugal
JCEF's Achievements
-
JCEF reacted to a file: AD - Active Directory UDF
-
JCEF reacted to a file: OutlookEX_GUI
-
JCEF reacted to a post in a topic: Need Serialnumber of Computer
-
JCEF reacted to a post in a topic: _FindInFile() - Search for a string within files located in a specific directory.
-
JCEF reacted to a post in a topic: Escreve Número por Extenso (Portuguese)
-
Get status of Windows Administrator password
JCEF replied to JCEF's topic in AutoIt General Help and Support
Good night! First of all, I want to thank you for your comments which I consider as a source of knowledge. In previous threads I have not given all the information. I'm not full domain administrator in my company. I can not manage Active Directory or Group Policy. Basically, I can only administer client computers from one of several "OUs" of domain. I can add or remove computers of this "OU", install or uninstall software on those computers, either by logging into the local administrator account, either by logging into my domain account (obviously with more privileges than the common user). Effectively, all the computers in this "OU" have the same password for access to the local administrator account, however when we create image files for replication in some computer models we forget to set this password. For these cases, when we add the computer to the domain, we manually set the password, but I'm afraid we can ever forget us. So I want a mechanism to correct this omission. I want, when run the script to add the computer to the domain, if the script sees that the password is not configured notify the user and ask him if he wants to set the password at this time. And also I did not want to save the password in the script and I do not want to keep asking the user to set the password, even when it is already set. Many thanks to both! -
Get status of Windows Administrator password
JCEF replied to JCEF's topic in AutoIt General Help and Support
Hello, spudw2k! Windows of course: what a fool I am. I consulted the topic you have indicated to me and helped me a lot. I do not know if it's the most correct way to do this, but I will implement as below. exemple: Local $PassAdminSet $PassAdminSet = CheckPassAdminSet() ConsoleWrite($PassAdminSet & @CRLF) If $PassAdminSet = "NotSet" Then MsgBox(16, "Error:", "The administrator password is not set!" & @CRLF & "Fix this problem and then restart this script!") Exit EndIf Func CheckPassAdminSet() Local $sUserName = "Administrator" Local $sPassword = "" Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, "cmd /c", "", @SW_HIDE) ProcessClose($iPID) If $iPID > 0 Then Return "NotSet" Else Return $iPID EndIf EndFunc ;==>CheckPassAdminSet Thank you all for your help. -
Get status of Windows Administrator password
JCEF replied to JCEF's topic in AutoIt General Help and Support
Hello, BrewManNH! Effectively, it is a good idea and I intend to do this, but I want to set the password only in cases that are not defined (pure laziness). Thanks for your suggestion. -
Good night! I have a script to add computers to the domain (works almost as I want), but at the beginning of the script I want to check if the account "Administrator" has a configured password (not blank). If the password is set (I do not want to know what password is set) the script continues normally, but if the password is not set the script stops and warns me that the password has to be defined. This will serve to no computer is delivered to the end user of the company where I work without the password is properly configured (on some computer models the administrator password is already configured in the image file for replication, but other models are not defined). I have done several searches and could not find solution. OS: Windows Since now, thank you all the help you can give me. Something like this: Local $PassAdminSet ; Code to check if the administrator password is set ; If password not set: $PassAdminSet = "NotSet" If $PassAdminSet = "NotSet" Then MsgBox(16, "Error:", "The administrator password is not set!" & @CRLF & "Fix this problem and then restart this script!") Exit EndIf
-
Re-run MsgBox when a user clicks No
JCEF replied to billrr02's topic in AutoIt General Help and Support
Good night! I think this is what you want .... Global $answer FuncMsg() Func FuncMsg() $answer = MsgBox(69684, "Title", "Test Message." & @CR & "" & @CR & "Would you like to restart now?") If $answer = 7 Then Sleep(30000) ; Time to wait FuncMsg() Else ;MsgBox(0,"", "Reboot") Shutdown(6) EndIf EndFunc ;==>FuncMsg Hope this helps. -
JCEF reacted to a post in a topic: get local admins
-
The easiest way I know is using "Robocopy.exe;" If my memory does not betray me, is native to the Windows OS from Windows Vista, but there is also a version for XP. ex: While 1 ShellExecuteWait(@SystemDir & "\Robocopy.exe", ' "' & 'DirSource" "DirDestin" /MIR /R:3 /W:3') ;ShellExecuteWait(@SystemDir & "\Robocopy.exe", ' "' & 'DirSource" "DirDestin" /MIR /R:3 /W:3', "", "", @SW_HIDE) Sleep(5000) WEnd Hope this helps!
-
Run Batch file command from autoit script
JCEF replied to camilla's topic in AutoIt General Help and Support
This had already been said. Sorry. I opened the page some time ago and I have not refreshed before this post. -
Run Batch file command from autoit script
JCEF replied to camilla's topic in AutoIt General Help and Support
Try _RunDos funtion: http://www.autoitscript.com/autoit3/docs/libfunctions/_RunDos.htm -
Hi gugs! I just put this piece of code: If Not ProcessExists($MyProcess) Then ShellExecute($MyAPP) EndIf because I was not sure if the "E-prime" actually closes and reopens when you press the 's', or simply changed the interface. But now evaluated best (I was a bit tired when I did this work), and it makes no sense its existence because the function "ProcessAPP_2 ()" is only called if the process ceases to exist when performing "ProcessAPP_1 ()". Ie, the "E-prime" actually ends and start again. I think you should also delete this entry "ShellExecute ($ myapp)" because, under normal conditions, the "E-prime" restarts on its own, correct? Try it, because if you start the application with AutoIt and if it has already been initiated by the "E-prime" you end up with multiple instances of the application open. Regarding the next question, I think it's enough that you put this piece of code at the beginning of your script: #include <Misc.au3> If _Singleton(@ScriptName, 0) = 0 Then Exit ; If srcipt already compiled Regarding the last question, in the tests that I did when I was using "Shift + s" or "Shift + x", with the "caps lock" on or off, AutoIt not answer and I do not know why: I do not have much knowledge in AutoIT. I also noticed that using the "HotKeySet ()" the "s" and "x" is not passed to the "notepad", which I used for testing instead of the "E-prime." For this reason and because using the function "_IsPressed ()" and not the "HotKeySet ()", I checked the hotkeys worked fine on the "notepad" and the AutoIT, I suggested the second version of the script.
-
If the "E-Prime" do not take the command of HotKeys 'S' and 'X' is as the previous script, try this: ;#NoTrayIcon #include <Misc.au3> ;Global $MyProcess = "notepad.exe" ;Global $MyAPP = @DesktopDir & "\MyDoc.txt" Global $MyProcess = "E-Prime.exe" Global $MyAPP = @DesktopDir & "\Task\Steve Task.ebs2" Global $Kpress = "" Global $hDLL = DllOpen("user32.dll") If Not ProcessExists($MyProcess) Then If FileExists($MyAPP) Then ShellExecute($MyAPP) Else MsgBox(16, "Error:", "Could not find: " & $MyAPP) Exit EndIf EndIf ProcessAPP() Func ProcessAPP() ProcessWait($MyProcess) While ProcessExists($MyProcess) Sleep(100) If _IsPressed("58", $hDLL) Then $Kpress = "Xyes" EndIf If _IsPressed("53", $hDLL) Then $Kpress = "Syes" EndIf WEnd ProcessAPP_2() EndFunc ;==>ProcessAPP Func ProcessAPP_2() If $Kpress = "Xyes" Then $Kpress = "" Exit ElseIf $Kpress = "Syes" Then $Kpress = "" If Not ProcessExists($MyProcess) Then ShellExecute($MyAPP) EndIf ProcessAPP() Else Exit EndIf EndFunc ;==>ProcessAPP_2
-
Good night! I think your video and your last topic were most enlightening. I do not think you need to look at the windows, but only for the process. See if it serves your purpose. ;#NoTrayIcon Global $Result = "" ;Global $MyProcess = "notepad.exe" ;Global $MyAPP = @DesktopDir & "\MyDoc.txt" Global $MyProcess = "E-Prime.exe" Global $MyAPP = @DesktopDir & "\Task\Steve Task.ebs2" Global $Xpress = "" Global $Spress = "" HotKeySet("x", "Terminate") HotKeySet("X", "Terminate") ; Beware using 'Shift + x' HotKeySet("s", "Restart") HotKeySet("S", "Restart") ; Beware using 'Shift + s' If Not ProcessExists($MyProcess) Then If FileExists($MyAPP) Then ShellExecute($MyAPP) Else MsgBox(16, "Error:", "Could not find: " & $MyAPP) Exit EndIf EndIf ProcessAPP() Func ProcessAPP() ProcessWait($MyProcess) While ProcessExists($MyProcess) Sleep(100) WEnd ProcessAPP_2() EndFunc ;==>ProcessAPP Func ProcessAPP_2() If $Xpress = "Xyes" Then $Xpress = "" Exit ElseIf $Spress = "Syes" Then $Spress = "" If Not ProcessExists($MyProcess) Then ShellExecute($MyAPP) EndIf ProcessAPP() Else Exit EndIf EndFunc ;==>ProcessAPP_2 Func Terminate() $Xpress = "Xyes" EndFunc ;==>Terminate Func Restart() $Spress = "Syes" EndFunc ;==>Restart Hope this helps.
-
Match values in Array with values in Excel
JCEF replied to drbyte's topic in AutoIt General Help and Support
Good night! I'm just a beginner in Excel and Autoit and liked that you confirm if this is wrong, because I want to learn more every day. Effectively, I could / should have created a variable for the name of the sheet ("Folha1"). The phrase was inserted in this context: ;....... $oExcel = _ExcelBookOpen(@ScriptDir & "\test\FileExcel.xlsx", 0) For $1 = 1 To UBound($aFiles) - 1 For $i = 2 To 21 If $aFiles[$1][1] = $oExcel.Sheets("Folha1").Range("A" & $i).Value Then $oExcel.Sheets("Folha1").Range("B" & $i).Value = StringUpper("x") EndIf Next Next _ExcelBookClose($oExcel) _ArrayDelete($aFiles, 0) ;....... Thank you in advance for your attention. -
Match values in Array with values in Excel
JCEF replied to drbyte's topic in AutoIt General Help and Support
Good night! In fact this sentence "$ oExcel.Sheets (" Folha1 ")" refers to the name of the first sheet (in portuguese). I found it interesting to identify the sheet because in future situations may be useful to you if you have to pass data to more than one sheet. I confess I have not looked very closely at your code. I focused on the end and just took in the values of array '$aFiles' and put them in Excel. For this potential error 'For $1 = 1 To UBound ($ aFiles) - 1' I do not agree with you. If you analizares the values passed by the arrays, certainly you will see that the value of 'Index 0' is just the number of files contained in the folder analyzed at the beginning of the script. I think that number is not necessary to transpose into Excel sheet, correct? May even bring you problems in the future, I think. Even you are not being consistent with what you wrote in your script. If you look closely near the end when you "; populate 2ND end result of dimensional array with stripped October file name" you use my discretion. thus: Your line: 'For $ i = UBound ($ atemp_Files) - 1 To 0 Step -1' I would change to: 'For $ i = UBound ($ atemp_Files) - 1 To 1 Step -1' and ... Your line: 'For $ 1 = 0 To UBound ($ atemp_Files) - 1' I would change to: 'For $ 1 = 1 To UBound ($ atemp_Files) - 1' But all this is just my opinion. Hope this helps. -
You have here a piece of work. You have tried to use the 'FileInstall ()' without macros or variables? With the absolute path? Perhaps the error occurs in the function 'FileSelectFolder ()' in the second parameter, since, as I understand, you changed the location of some folders as 'desktopdir', which is used in the second parameter of the function 'FileSelectFolder ()'. Already analize the path that macros 'DesktopDir @', '@ HomeDrive' and '@ HomePath' return to you? Is that correct? Execute the command 'SET' without parameters in MS-DOS and see if everything is right. I hope these ideas help you to realize what is wrong in your script.
-
JCEF reacted to a post in a topic: How to make a simple database?
-
gugs, I am also beginner. I know it is sometimes difficult to follow the reasoning of others, but this is no problem. What only matters is not giving up. With your problem I am also learning something else. I think I had misunderstood your initial explanation, so I made some changes. See if this is close to what you intend: #NoTrayIcon Global $Result Global $MyProcess = "Everything-1.2.1.371.exe" Global $MyAPP = @ScriptDir & "\Everything-1.2.1.371.exe" Global $strTextWinFinal = "Everything 1.2.1.371 has been installed on your computer." ; $strTextWinFinal - Esta variável deve ser uma substring do texto da janela final da aplicação (janela final de agradecimento.) ; Deve conter um texto único, que não será encontrado além da janela final. ; $StrTextWinFinal - This variable must be a substring of the text of the final window of the application (the final window of thanks.) ; Must contain a single text, which will not be found beyond the final window. HotKeySet("x", "Terminate") HotKeySet("X", "Terminate") ; Beware using 'Shift + x' HotKeySet("s", "Restart") HotKeySet("S", "Restart") ; Beware using 'Shift + s' ; If your application also responds to these HotKeys, I think best to use the function '_IsPressed ()' as shown in another script If Not ProcessExists($MyProcess) Then ShellExecute($MyAPP) EndIf ProcessWait($MyProcess) ProcessAPP() Func ProcessAPP() While ProcessExists($MyProcess) Local $TextWin = WinGetText("Everything 1.2.1.371 Setup") ; Here you put the TITLE of your final window If StringInStr($TextWin, $strTextWinFinal) Then $Result = "EndOK" ; You have reached the final window and ended without interruptions ProcessWaitClose($MyProcess) ; If it does not close himself, force with: 'If ProcessExists ($ myProcess) Then ProcessClose ($ myProcess)' EndIf Sleep(100) ; Necessary to avoid overloading the processor WEnd If $Result = "EndOK" Then ; If is over OK ... Sleep(2000) ; ... hold and ... ShellExecute($MyAPP) ; ... restart the application: - can be omitted if the application start again alone ProcessWait($MyProcess) $Result = "" ; empties the variable to restart the application ProcessAPP() ; restart Else ; Closed application incorrectly Exit ; End Autoit EndIf EndFunc ;==>ProcessAPP Func Terminate() ProcessClose($MyProcess) Exit EndFunc ;==>Terminate Func Restart() $title = WinGetTitle("[active]") If ProcessExists($MyProcess) Then ProcessClose($MyProcess) ProcessWaitClose($MyProcess) If WinExists($title) Then WinClose($title) WinWaitClose($title) ; I think you had an error here Sleep(5000) If Not ProcessExists($MyProcess) Then ShellExecute($MyAPP) EndIf ProcessWait($MyProcess) EndFunc ;==>Restart I hope this helps