Sign in to follow this  
Followers 0
rajatrg

Newbie Help Needed

6 posts in this topic

#1 ·  Posted (edited)

Dear Sir,

 

I'm not a programming guy, I hired someone to make a autoit script and script was working absolutely fine

I was just testing something and I just opened the script, run it and forced to exit it, before completing the steps 

after that I'm getting error "Subscript used n non-accessible variable"

Can you please help to solve this issue as my developer is on vacation and I need to fix it urgently 

Script was running absolutely fine before 

Error is on Line 19 " c:/user/name/desktop/new auto it vs3.au3"

 

For$= 1 to $videofile(0)

For$= 1 to "videofiles" Error

 

Can you please suggest me a solution ?

This script is for editing the videos 

Edited by Melba23
Fixed formatting

Share this post


Link to post
Share on other sites



Post the script.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello Sir, I got the script fixed, it started running, but now script completely changed and not working fine 

Complete script and I asked few other peoples, they said autoIT is not stable and useful, is it like that ?

#include <File.au3>


$templateFile = @DesktopDir & "\\WWE.prproj"
$oldVideoFileName = ""
$videoFolder = "C:\\Users\\Rajat\\Videos\\All Videos\\"

$tempFile = FileOpen("old name.txt", 0)
If $tempFile = -1 Then
    MsgBox(16, "old name.txt is missing", "Can't proceed, because old name is missing")
EndIf

$oldVideoFileName = FileRead($tempFile)
FileClose($tempFile)

;MsgBox(0, "", $oldVideoFileName)

$videoFiles = _FileListToArray($videoFolder) ;, "*.mp4"

For $i = 1 To $videoFiles[0]
    $currentFile = $videoFiles[$i]
    ;ConsoleWrite($currentFile & @CRLF)

    $tempFile = FileOpen($templateFile, 0)
    If $tempFile = -1 Then
        MsgBox(16, "WWE.prproj is missing", "Can't proceed, because WWE.prproj is missing")
    EndIf

    $templateFileRead = FileRead($tempFile)
    FileClose($tempFile)

    $templateFileRead = StringReplace($templateFileRead, $oldVideoFileName, $currentFile)

    $tempFile = FileOpen($templateFile, 2)
    FileWrite($tempFile, $templateFileRead)
    FileClose($tempFile)

    #cs
    Run("notepad.exe " & $templateFile)

    WinWait("WWE - Notepad")

    If WinExists("WWE - Notepad") Then
        WinActivate("WWE - Notepad")
        Sleep(1000)
        Send("^h") ;Run replace tool by CTRL+H
        Send($oldVideoFileName)
        Send("{TAB}")
        Send($currentFile)
        Send("!a") ;Press ALT+A to replace all
        Sleep(5000)
        Send("{ESCAPE}")
        Sleep(500)
        Send("^s") ;Save file
        Sleep(2000)
        ;WinClose("WWE - Notepad")
    EndIf
    #ce

    Sleep(250)
    ShellExecute(@DesktopDir & "\\WWE.prproj")

    ;Resize image
    WinWaitActive("[CLASS:Premiere Pro]")
    Sleep(4000)

    #cs Changes something else
    Send("+1")
    Send("{DOWN 3}") ;down three times
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("^c{ESCAPE}") ;copy to clipboard and close dialog
    Sleep(250)

    Send("{DOWN}") ;switch to first image
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)

    Send("{DOWN}") ;switch to second image
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)
    #ce

    MouseClick("left", 564, 564)
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("^c{ESCAPE}") ;copy to clipboard and close dialog
    Sleep(250)

    MouseClick("left", 540, 540)
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)

    MouseClick("left", 590, 590)
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)

    ;Send("+3")
    Send("^m") ;CTRL+M to export
    Sleep(500)
    Send("{TAB 7}")
    Sleep(250)
    Send("{SPACE}")
    Sleep(2500)
    Send($currentFile)
    Send("{ENTER}")
    Sleep(250)
    Send("{TAB 22}{SPACE}")
    WinWaitActive("[CLASS:Premiere Pro]")
    Send("^+w") ;CTRL+SHIFT+W to quit
    Sleep(250)
    Send("{TAB}{SPACE}") ; don't save the file

    Sleep(500)
    $oldVideoFileName = $currentFile
    ;WinClose("WWE - Notepad")
    Sleep(250)
Next

cleanup()

$tempFile = FileOpen("old name.txt", 2) ;overwrite
FileWrite($tempFile, $oldVideoFileName)
FileClose($tempFile)

Func cleanup()
    ;Delete the files from the All Videos folder
    FileDelete($videoFolder)
EndFunc

I guess their is problem due to files changed due to script stopped in between ?

I tried to replace with backup file too, but still I got the same error

Edited by Melba23
Merged and added code tags

Share this post


Link to post
Share on other sites
If Not @error Then
For $i = 1 To $videoFiles[0]
    $currentFile = $videoFiles[$i]
    ;ConsoleWrite($currentFile & @CRLF)

    $tempFile = FileOpen($templateFile, 0)
    If $tempFile = -1 Then
        MsgBox(16, "WWE.prproj is missing", "Can't proceed, because WWE.prproj is missing")
    EndIf

    $templateFileRead = FileRead($tempFile)
    FileClose($tempFile)

    $templateFileRead = StringReplace($templateFileRead, $oldVideoFileName, $currentFile)

    $tempFile = FileOpen($templateFile, 2)
    FileWrite($tempFile, $templateFileRead)
    FileClose($tempFile)

    #cs
    Run("notepad.exe " & $templateFile)

    WinWait("WWE - Notepad")

    If WinExists("WWE - Notepad") Then
        WinActivate("WWE - Notepad")
        Sleep(1000)
        Send("^h") ;Run replace tool by CTRL+H
        Send($oldVideoFileName)
        Send("{TAB}")
        Send($currentFile)
        Send("!a") ;Press ALT+A to replace all
        Sleep(5000)
        Send("{ESCAPE}")
        Sleep(500)
        Send("^s") ;Save file
        Sleep(2000)
        ;WinClose("WWE - Notepad")
    EndIf
    #ce

    Sleep(250)
    ShellExecute(@DesktopDir & "\\WWE.prproj")

    ;Resize image
    WinWaitActive("[CLASS:Premiere Pro]")
    Sleep(4000)

    #cs Changes something else
    Send("+1")
    Send("{DOWN 3}") ;down three times
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("^c{ESCAPE}") ;copy to clipboard and close dialog
    Sleep(250)

    Send("{DOWN}") ;switch to first image
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)

    Send("{DOWN}") ;switch to second image
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)
    #ce

    MouseClick("left", 564, 564)
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("^c{ESCAPE}") ;copy to clipboard and close dialog
    Sleep(250)

    MouseClick("left", 540, 540)
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)

    MouseClick("left", 590, 590)
    Send("^r") ;open speed/duration
    Sleep(100)
    Send("{TAB}")
    Send("^v{ENTER}") ;paste the length from clipboard
    Sleep(250)

    ;Send("+3")
    Send("^m") ;CTRL+M to export
    Sleep(500)
    Send("{TAB 7}")
    Sleep(250)
    Send("{SPACE}")
    Sleep(2500)
    Send($currentFile)
    Send("{ENTER}")
    Sleep(250)
    Send("{TAB 22}{SPACE}")
    WinWaitActive("[CLASS:Premiere Pro]")
    Send("^+w") ;CTRL+SHIFT+W to quit
    Sleep(250)
    Send("{TAB}{SPACE}") ; don't save the file

    Sleep(500)
    $oldVideoFileName = $currentFile
    ;WinClose("WWE - Notepad")
    Sleep(250)
Next
EndIf

 


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi sir, I am having backup of old script, which was working fine, Does I should work on Fixing the template on which script was running ? or should I hire someone to fix it ?

 

as I need it urgently fixed, I hired 1 guy yesterday, He worked for more than 20 hours and he is unable to do it, as he is also a newbie , Does somebody can help me via teamvewer or guiding Please it's urgent for me to fix it 

Edited by rajatrg

Share this post


Link to post
Share on other sites

it's hard to know where it fails without more info.

Perhaps insert write console or msgbox to see how far you get.

the use of mouse clicks is very fragile as the screen positions may change.

use the info tool to verify that they are still correct

also there may be no problem with the code - it may be failing due to a change in the files in the folder that it is accessing.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • masterland
      By masterland
      Hello.
      I had made a bot that clicks and doing stuff. It is working fine, but when i move it to another PC ImageSearch stop working. I captured same image of a button again and i observed that they are a little bit different. How to deal with this? I wonder if i will make black and white detection might work, or not ... i don't know. The point is i am not willing to re-do photos on each and every PC i move the scripts.
       
      ClickOnImageWithToleranceFast("images/fb_about.bmp",16) Func ClickOnImageWithToleranceFast($image_path,$tolerance) If SearchForImageOnScreenWithTolerance($image_path,$tolerance) Then If $x <> 0 And $y <> 0 Then MouseMove($x+5, $y+5,0) Sleep(500) MouseClick("left") Sleep(500) EndIf EndIf EndFunc  
      Link : https://postimg.org/gallery/z6n168ps/585debf1/#
      Also i have attached them.
      Thank you
      fb_about.bmp
      fb_about2.bmp
    • akira2891
      By akira2891
      Hi,
      I was wondering is this all inputs can be done in 1 box with 3 fields and not to use another gui.
      And how can i validate data for example if i don't enter username he prompt me a message box all time until field is empty.
      I try like this but it give me a msgbox and continue on another field.
      $username = InputBox("Add new user", "Username", "", "", 200, 130, Default, Default, 0) if $username <> " " then msgbox(0, "", "Please enter username") endif $email = InputBox("Add new user", "Email", "", "", 200, 130, Default, Default, 0) $password = InputBox("Add new user", "Password", "", "*", 200, 130, Default, Default, 0)  
    • ExiLeD4EveR
      By ExiLeD4EveR
      Hello guys, i need help with something. Don't show me other similar threads pls i searched everything and nothing helped my situation. I just need when i press the checkbox in the password form to hide the text and show up as ** and when i press it again it should show letters instead of **.  Thanks in advance!
       
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <IE.au3> #Region ### START Koda GUI section ### Form=c:\users\EXILED\desktop\coding\autoit\gui samples\simplegui.kxf $SimpleGUI = GUICreate("MultiProgram", 392, 122, -1, -1) GUISetIcon("C:\Users\EXILED\Desktop\Work\Smile\Icon Pack\EcranLcd.ico", -1) $Notepad = GUICtrlCreateButton("Notepad", 16, 24, 73, 25) GUICtrlSetCursor (-1, 0) $Calculator = GUICtrlCreateButton("Calculator", 112, 24, 73, 25) GUICtrlSetCursor (-1, 0) $ExitButoon = GUICtrlCreateButton("Exit", 160, 72, 73, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 0) $Lol = GUICtrlCreateButton("Lol Login", 208, 24, 73, 25) GUICtrlSetCursor (-1, 0) $Facebook = GUICtrlCreateButton("Facebook ", 304, 24, 73, 25) GUICtrlSetCursor (-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Calculator StartCalc() Case $Notepad StartNotepad() Case $Facebook ;= if Facebook is pressed it creates the email form $Face_Login = GUICreate("Facebook Login", 295, 88, -1, -1) GUISetIcon("C:\Users\EXILED\Downloads\Iconshock-Social-Media-Beakers-Facebook.ico", -1) $Label1 = GUICtrlCreateLabel("Email", 40, 24, 29, 17) $InputBox1 = GUICtrlCreateInput("", 72, 21, 148, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Email_button = GUICtrlCreateButton("Done", 96, 56, 97, 25) GUISetState(@SW_SHOW) ;Case $nMsg = $button ;$read = GUICtrlRead ($Password) ;GUICtrlDelete ($Password) ;If $shown Then ; $shown = False ; $Password = GUICtrlCreateInput($read, 20, 75, 160, 20, $ES_PASSWORD) ; GUICtrlSetData($button, "Show Password") ;Else ; $shown = True ; $Password = GUICtrlCreateInput($read, 20, 75, 160, 20, $GUI_SS_DEFAULT_INPUT) ; GUICtrlSetData($button, "Hide Password") ;EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Email_button ;= if Done from email form is pressed then delete the email form and open the password form $data1 = GUICtrlRead($InputBox1) GUIDelete($Face_Login) Sleep(200) $Face_Login2 = GUICreate("Facebook Login", 295, 120, -1, -1) GUISetIcon("C:\Users\ExILD\Downloads\Iconshock-Social-Media-Beakers-Facebook.ico", -1) $Label2 = GUICtrlCreateLabel("Password", 16, 24, 50, 17) $InputBox2 = GUICtrlCreateInput("", 72, 21, 148, 21, $ES_PASSWORD) $Pass_button = GUICtrlCreateButton("Done", 96, 88, 97, 25) $Checkbox1 = GUICtrlCreateCheckbox("Show Password", 16, 56, 105, 17, $BS_CENTER) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 $read = GUICtrlRead($InputBox2) GUICtrlDelete($InputBox2) If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then MsgBox(64, "Checked successfully!", "Your password is now visible", 10) Else MsgBox(64, "Unchecked successfully!", "Your password is now hidden",10) EndIf Case $Pass_button;= if Done from password form is pressed then it deletes the password form and , to add(open internet explorer on the facebook login page $data2 = GUICtrlRead($InputBox2) GUIDelete($Face_Login2) FB_SignIn() EndSwitch WEnd EndSwitch WEnd EndSwitch WEnd Func FB_SignIn() Global $oIE = _IECreate("https://www.facebook.com/") Local $username = _IEGetObjByName($oIE, "email") Local $password = _IEGetObjByName($oIE, "pass") Local $button = _IEGetObjById($oIE, "loginbutton") _IEFormElementSetValue($username, $data1) _IEFormElementSetValue($password, $data2) _IEAction($button, "click") EndFunc Func StartNotepad() Run("notepad.exe") EndFunc Func StartCalc() Run("calc.exe") EndFunc  
    • ExiLeD4EveR
      By ExiLeD4EveR
      'm trying to make an autologin script for facebook which prompts u to enter an email and a password and then opens the browser and logs you with the info u entered but im having a problem with the text entered in the input box. What i basically want it to do is take what's written on the inputbox and replace it on the email form in the facebook site and the password. Don't mind the other buttons in the gui , i just wanted to focus on the facebook button first. Any help will be appreciated
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <IE.au3> #Region ### START Koda GUI section ### Form=c:\users\ExiLeD\desktop\coding\autoit\gui samples\simplegui.kxf $SimpleGUI = GUICreate("MultiProgram", 392, 122, -1, -1) GUISetIcon("C:\Users\ExiLeD\Desktop\Work\Smile\Icon Pack\EcranLcd.ico", -1) $Notepad = GUICtrlCreateButton("Notepad", 16, 24, 73, 25) GUICtrlSetCursor (-1, 0) $Calculator = GUICtrlCreateButton("Calculator", 112, 24, 73, 25) GUICtrlSetCursor (-1, 0) $ExitButoon = GUICtrlCreateButton("Exit", 160, 72, 73, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 0) $Lol = GUICtrlCreateButton("Lol Login", 208, 24, 73, 25) GUICtrlSetCursor (-1, 0) $Facebook = GUICtrlCreateButton("Facebook ", 304, 24, 73, 25) GUICtrlSetCursor (-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Facebook ;= if Facebook is pressed it creates the email form $Face_Login = GUICreate("Facebook Login", 295, 88, -1, -1) GUISetIcon("C:\Users\ExiLeD\Downloads\Iconshock-Social-Media-Beakers-Facebook.ico", -1) $Label1 = GUICtrlCreateLabel("Email", 40, 24, 29, 17) $InputBox1 = GUICtrlCreateInput("", 72, 21, 148, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $data1 = GUICtrlRead(-1) $Email_button = GUICtrlCreateButton("Done", 96, 56, 97, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Email_button ;= if Done from email form is pressed then delete the email form and open the password form GUIDelete($Face_Login) Sleep(200) $Face_Login2 = GUICreate("Facebook Login", 295, 88, -1, -1) GUISetIcon("C:\Users\ExiLeD\Downloads\Iconshock-Social-Media-Beakers-Facebook.ico", -1) $Label2 = GUICtrlCreateLabel("Password", 16, 24, 50, 17) $InputBox2 = GUICtrlCreateInput("", 72, 21, 148, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $data2 = GUICtrlRead(-1) $Pass_button = GUICtrlCreateButton("Done", 96, 56, 97, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Pass_button ;= if Done from password form is pressed then it deletes the password form and , to add(open internet explorer on the facebook login page GUIDelete($Face_Login2) FB_SignIn() EndSwitch WEnd EndSwitch WEnd EndSwitch WEnd Func FB_SignIn() Global $oIE = _IECreate("https://www.facebook.com/") Local $username = _IEGetObjByName($oIE, "email") Local $password = _IEGetObjByName($oIE, "pass") Local $button = _IEGetObjById($oIE, "loginbutton") _IEFormElementSetValue($username, $data1) _IEFormElementSetValue($password, $data2) _IEAction($button, "click") EndFunc  
    • messilm10
      By messilm10
      how do i get the crash report of any application and any running script?????