Jump to content

Andy2k14

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

68 profile views

Andy2k14's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi all, Still learning AutoIt, can anyone recommend how i can do the following: Continuously search for a .txt file in a designated directory The search will continue indefinatley until the user closes the program or the file is found If file found open file and read 1st line of txt file close file end program Ive been looking at using the "read first line" function but having difficulty with the syntax format. The example is not (in my opinion) noob friendly. Any help appreciated
  2. Hi all, can anyone tell me why this code does not run as expected. ;Pick out last 2 characters Local $sString = StringRight($sText, 2) ; Retrieve 2 characters from the right of the string. If $sString == 'RE' Then $OutputDir = 'C:\Folder1' ElseIf $sString == 'RF' Then $OutputDir = 'C:\Folder2' ElseIf $sString == '9J' or 'JA' or 'JB' or 'JC' or 'S1' Then $OutputDir = 'C:\Folder3' ElseIf $sString == '6E' or '7E' or '8E' Then $OutputDir = 'C:\Folder4' Else MsgBox($MB_SYSTEMMODAL, "", "Type Not Recognised") ;unrecognised part, exit program Exit EndIf Its supposed to work like this: 1) get last two characters from string 2) If characters match change $OutputDir 3)If none of the characters match produce error message. It sort of works but the message box error message never seems to trigger regardless. thanks
  3. Yes i have just tried it and it produces the same error. Very frustrating problem.
  4. Hello All, recently i have been trying to use Autoit to open an application. I have successfully used Autoit to load the app but have encountered a strange problem where once the App has been opened using AutoIT an Unhandled Exception Error is produced. This error does not appear if i manually open the App, therefore i think it has something to do with AutoIt. The script code i am using is: #include <Constants.au3> #include <MsgBoxConstants.au3> run("C:\MyApp\MyApp.exe", "C:\MyApp", @SW_SHOWMAXIMIZED) winwait("[TITLE:MyApp]") Exit As you can see its a very basic script. There is a clear difference between autoit opening the App and manually opening the App. The error message i get is: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.ArgumentException: Invalid name. Parameter name: name at System.Security.AccessControl.NativeObjectSecurity.CreateInternal(ResourceType resourceType, Boolean isContainer, String name, SafeHandle handle, AccessControlSections includeSections, Boolean createByName, ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext) at System.Security.AccessControl.FileSystemSecurity..ctor(Boolean isContainer, String name, AccessControlSections includeSections, Boolean isDirectory) at System.Security.AccessControl.DirectorySecurity..ctor(String name, AccessControlSections includeSections) at TrwVisionClient.Model.PgmWriter.HasWriteAccess(String path) at TrwVisionClient.Presenter.MainPresenter.View_OnGetPgmRequest() at TrwVisionClient.View.MainView.StartCommButtonClick(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- TrwVisionClient Assembly Version: 3.0.2.0 Win32 Version: 3.0.2.0 CodeBase: file:///C:/MyApp/MyApp.exe ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- CommandLine Assembly Version: 1.9.71.2 Win32 Version: 1.9.71.2 CodeBase: file:///C:/MyApp/CommandLine.DLL ---------------------------------------- System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- PgmDownloader Assembly Version: 1.0.0.8 Win32 Version: 1.0.0.8 CodeBase: file:///C:/MyApp/PgmDownloader.DLL ---------------------------------------- System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- 4ruj2ecw Assembly Version: 3.0.2.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- vxlapi_NET20 Assembly Version: 8.3.4737.17695 Win32 Version: 8.3.4737.17695 CodeBase: file:///C:/MyApp/vxlapi_NET20.DLL ---------------------------------------- ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration> <system.windows.forms jitDebugging="true" /> </configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box. Ive also attached a screenshot of the error. Can anyone help? Thanks
  5. i need the loop to check for a colour change on a certain pixel. I am allowing 12 seconds for this to happen. If the pixel colour does not change within 12 seconds i want to script to exit. If the colour changes within 12 seconds the script is to continue as normal. I could just sleep for 12 seconds then do a pixel check but in my application the colour change can happen anywhere betyween 1 and 12 seconds. I save cycle time this way.
  6. Can anyone spot why my code is broken. It complains it is missing a Next statement. ;Poll pixel colour until SPTAC is set or 12 seconds has elapsed For $i = 1 To 12 Step +1 local $Status_Colour = PixelGetColor(24, 207) If $Status_Colour = 15790320 Then ExitLoop ElseIf $Status_Colour = 0 then MsgBox($MB_SYSTEMMODAL, "", "Please restart the application") Exit EndIf wait(1000) Next Thanks
  7. You sir are a legend!
  8. Ok, here the code. Its not much. #include <Constants.au3>#include <MsgBoxConstants.au3> run("C:\MyApp\MyApp.exe") Exit Things i dont understand: How is calling the App in AutoIT different to manually opening the App with the mouse. Same location and everything. Are there any tools i can look at to see what windows is doing to try and debug this? The App loads in both instances yet only the manual open detects the drivers associated with the App and works as intended. I am lost!
  9. Hi All, Noob here trying to figure out this annoying problem. i am using AutoIT to run an .exe. I have managed to create the code and successfully open my .exe application. However what i have noticed is there is a difference in how my application runs depnding whether i manaully open it using the mouse or use AutoIt to open the .exe. The same directory is used each time. I cant understand why my application would run differently when called from Autoit but run fine when manully opening the program. Very strange. Although it looks like my script has worked, in the script editor i noticed it comes out with an ErrorStdOut message. also i have ran the AutoIt windows tool to look at class names and everything is identical except the handler number. If i manually open my .exe the handler is different to that when i open it through AutoIt. Has anyone seen this before? thanks
×
×
  • Create New...