Jump to content

Find string and delete 4 lines after that


Recommended Posts

Hej i am a total newbie..... dont know anything about programming everything i have writen is ether from help file or from this forum :graduated:

And i was hopeping some one can help me

I want to search case.au3 for a selected string.

When the string is found its has to delete the string and the next 4 lines after that.

Exsample.: It Findes Simpsons and then delete (Case "Simpsons" ) and the next 4 lines

Case "Simpsons"

$Picsave = @ScriptDir & "\Sys\ASG-Logo.jpg"

$source = "http://epguides.com/Simpsons/Show%20Logo.jpg"

inetget($source, $Picsave)

GUICtrlSetImage($Pic1, $Picsave)

editcase.au3

Link to comment
Share on other sites

  • Moderators

islandspapand,

I assume this is for one of your own scripts, or at least one for which you have the source - so why are you not doing this manually? That would almost certainly be quicker than writing a script to do it! :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Yes it is.

I am not doing it manually because it is af func i whan to give me delete button. Here is my full project.

This is my first draft of the script so it is not very tidy. and not all of the func work yet.

So the function i want to give my del button is it del the select item from Info.txt and the case sentace from my case.au3 file

a second question i was woundering if there was any way to Include a file from a subfolder exs. <@scriptdir & "\sys\cases.au3"> .

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author:      Islandspapand
Script Function:
Add new series and chech release dates
Popup when new episode avalibale
#ce ----------------------------------------------------------------------------

#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListview.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#include <EditConstants.au3>
#include <String.au3>
#include <File.au3>
#include <Array.au3>
#include <Date.au3>
#include <Process.au3>
#include <ProgressConstants.au3>
#include <IE.au3>

$Picreate = @scriptdir & "\Sys\ASG-Logo.jpg"
$Infocreate = @scriptdir & "\Sys\Info.txt"
$Newccreate = @scriptdir & "\Sys\newc.txt"

If FileExists(@scriptdir & "\Sys\") Then
   ElseIf DirCreate(@scriptdir & "\Sys\") Then
EndIf
If FileExists($Infocreate) Then
     $FilenotE = 0
Elseif $FilenotE = 1 Then
FileWrite($infocreate,"")
$Contininf = 1
EndIf

  If FileExists($Newccreate) Then
     $FilenotE2 = 0
Elseif $FilenotE2 = 1 Then
FileWrite($Newccreate,"Case ""EDIT"""& @CRLF & _
  "$Picsave = @ScriptDir & ""\Sys\ASG-Logo.jpg""" & @CRLF & _
  "$source = ""****""" & @CRLF & _
  "inetget($source, $Picsave)"& @CRLF & _
  "GUICtrlSetImage($Pic1, $Picsave)")
EndIf

If FileExists($Picreate) Then
    $FilenotE1 = 0
Elseif $FilenotE1 = 1 Then
FileWrite($Picreate,"")
EndIf
Global $Edit1, $ASG
Global $File = @scriptdir & "\Sys\info.txt"
Global $Text = FileRead($File)
_ASG()
Func _ASG()
$ASG = GUICreate("Series Guide 2011", 499, 383, 193, 121)
$FileM = GUICtrlCreateMenu("&File")
$FileMB = GUICtrlCreateMenuItem("Browse", $FileM)
$FileMF = GUICtrlCreateMenuItem("File", $FileM)
$FileME = GUICtrlCreateMenuItem("Exit", $FileM)
$AboutM = GUICtrlCreateMenu("About")
$MenuItem10 = GUICtrlCreateMenuItem("MenuItem10", $AboutM)
$MenuItem11 = GUICtrlCreateMenuItem("MenuItem11", $AboutM)
$Edit1 = GUICtrlCreateList("", 16, 136, 129, 201)
GUICtrlSetData($Edit1, $Text)
$Label1 = GUICtrlCreateLabel("Series", 16, 104, 132, 17)
$ADDB = GUICtrlCreateButton("Add New Series", 16, 16, 129, 33)
$DELB = GUICtrlCreateButton("Delete Series", 16, 56, 129, 33)
$DLB = GUICtrlCreateButton("Download ", 160, 248, 137, 33)
$GTB = GUICtrlCreateButton("Goto", 160, 296, 137, 33)
$Group1 = GUICtrlCreateGroup("Newest Realse", 160, 136, 145, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Last Episode", 160, 184, 145, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Radio1 = GUICtrlCreateRadio("Radio1", 312, 200, 17, 17)
$Radio2 = GUICtrlCreateRadio("Radio1", 312, 148, 17, 17)
$Group3 = GUICtrlCreateGroup("Epiosde List", 352, 16, 129, 313)
$Pic1 = GUICtrlCreatePic("", 160, 16, 145, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
 
While 1
$nMsg = GUIGetMsg()

Switch $nMsg
  Case $GUI_EVENT_CLOSE
  Exit
 
Case $GTB
Case $DLB
 
Case $DELB
  $Listsel = GUICtrlRead($Edit1)
  $szFile = @scriptdir & "\Sys\info.txt"
     $szText = FileRead($szFile, FileGetSize($szFile))
     $szText = StringReplace($szText,$Listsel & "|", "")
     FileDelete($szFile)
     FileWrite($szFile, $szText)
  GUICtrlSetData($Edit1, "")
  $TxtR = FileRead($szFile)
  GUICtrlSetData($Edit1, $TxtR)
 
Case $ADDB
  GUISetState(@SW_DISABLE, $ASG)
  _ADDSeries()
  GUISetState(@SW_ENABLE, $ASG)
  GUICtrlSetData($Edit1, "")
  $FileR = @scriptdir & "\Sys\info.txt"
  $TextR = FileRead($FileR)
      GUICtrlSetData($Edit1, $TextR)
        WinActivate($ASG)
  
Case $Edit1
   Switch GUICtrlRead($Edit1)
   #include <cases.au3>   
    EndSwitch
 
 
    EndSwitch
WEnd
EndFunc

Func _Addseries()
$Form1 = GUICreate("Add Series", 192, 79, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 8, 32, 177, 21)
$Label1 = GUICtrlCreateLabel("    Enter Your Series Name Her:", 8, 8, 158, 17)
$OK = GUICtrlCreateButton("OK", 8, 56, 81, 17)
$Cancel = GUICtrlCreateButton("Cancel", 104, 56, 81, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Cancel
  GUIDelete($Form1)
  ExitLoop
  
  Case $OK
  $Inputd = GUICtrlRead($Input1)
  $searchterm = StringReplace("site:epguides.com " & $Inputd, " ", "+")
  $url = "http://www.google.com/search?hl=en&q=" & $searchterm & "&btnI=I%27m+Feeling+Lucky&aq=f&oq="
  $oIE = _IECreate ($url,0,0)
  $oImg = _IEImgGetCollection ($oIE, 1)
  $sInfo = $oImg.src
  $FileW = @scriptdir & "\Sys\info.txt"
     FileWrite($FileW,$Inputd & "|")
  $FileR = @scriptdir & "\Sys\newc.txt"
  $TextR = FileRead($FileR)
        $FileRC = @scriptdir & "\cases.au3"
  FileWrite($FileRC, @crlf & $TextR)
  $RCText = FileRead($FileRC, FileGetSize($FileRC))
     $RCText = StringReplace($RCText,"EDIT", $Inputd)
  $RCText = StringReplace($RCText,"****", $sInfo)
     FileDelete($FileRC)
     FileWrite($FileRC, $RCText)
  GUIDelete($Form1)
  ExitLoop
   
EndSwitch
WEnd
EndFunc
Edited by islandspapand
Link to comment
Share on other sites

  • Moderators

islandspapand,

OK, I see what you are trying to do - but I am not sure that you can do it! ;)

Let me think about it for a while - I will try and come up with a solution. :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

islandspapand,

That is one of problems caused by you trying to dynamically include a file - you can only include a file at the start. :graduated:

Do not hold your breath - this could take a while! ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

islandspapand,

Disclaimer: Before we start I would like to say that this is not my preferred way to go about doing this and I would have structured the whole script very differently had I been writing it. But based on your extremely novel "external case file" concept this seems to offer the fastest way to get you up and running. :graduated:

Rather than including the "cases.au3" file, we are going to run it as a separate script using an ini file to pass the details back and forth between it and the main script.

Your "cases.au3" file needs to look like this - obviously you need to change the data to the correct values: :D

$sIni = @ScriptDir & "\Details.ini"
 
Switch $CmdLine[1]
    Case "Simpsons"
        IniWrite($sIni, "Details", "Pic", @ScriptDir & "\Sys\ASG-Logo.jpg")
        IniWrite($sIni, "Details", "Source", "http://epguides.com/Simpsons/Show%20Logo.jpg")
    Case "Spooks"
        IniWrite($sIni, "Details", "Pic", @ScriptDir & "\Sys\ASG-Logo.jpg")
        IniWrite($sIni, "Details", "Source", "http://epguides.com/Spooks/Show%20Logo.jpg")
    Case "Sherlock"
        IniWrite($sIni, "Details", "Pic", @ScriptDir & "\Sys\ASG-Logo.jpg")
        IniWrite($sIni, "Details", "Source", "http://epguides.com/Sherlock/Show%20Logo.jpg")
    Case "Poirot"
        IniWrite($sIni, "Details", "Pic", @ScriptDir & "\Sys\ASG-Logo.jpg")
        IniWrite($sIni, "Details", "Source", "http://epguides.com/Poirot/Show%20Logo.jpg")
EndSwitch

You will see that we are using the built-in $CmdLine array to get the parameters passed to the script - look at the <Using AutoIt - Running Scripts - Command Line Parameters> section of the Help file to learn all about it. ;)

When run the script will use the Switch structure to select the Case to match the parameter we sent it (see later for how we do this) and then write the correct data to the ini file for use by the calling script.

Now the calling script has to get "cases.au3" to run and collect the data written into the ini file. This is the section of your script where you were originally trying to include the file:

Case $Edit1
    ; We ask AutoIt to run cases.au3 using the content of $Edit1 as the parameter
    ; and to wait until it finishes
    RunWait("AutoIt3.exe /AutoIt3ExecuteScript cases.au3 " & GUICtrlRead($Edit1))
    ; Now we read the values from the ini file
    $source = IniRead(@ScriptDir & "\Details.ini", "Details", "Source", "")
    $Picsave = IniRead(@ScriptDir & "\Details.ini", "Details", "Pic", "")
    ; And you do what you did before
    inetget($source, $Picsave)
    GUICtrlSetImage($Pic1, $Picsave)

The <Using AutoIt - Running Scripts - AutoIt specific command Line Switches> section of the Help file explains all about running scripts from within other scripts. :)

Finally we get to your initial question about deleting Cases from "cases.au3". :D

You will need to add a button within your main script and then run code like this when it is actioned: :D

; Create an array
Local $aCases
; Read cases.au3 into the array
_FileReadToArray("cases.au3", $aCases)
; Read the Case to be deleted - you will have to do arrange this within the main script
$sCase = GUICtrlRead(Some-control)
; Find the Case statement in the file - look in the Help file to see what the parameters do, particularly the final 1
$iIndex = _ArraySearch($aCases, 'Case "' & $sCase & '"', 0, 0, 0, 1)
; Now delete the Case line and the 2 lines that follow
For $i = 1 To 3
    _ArrayDelete($aCases, $iIndex)
Next
; And finally rewrite the file without those lines - again look in the Help file to see why I have the final 1
_FileWriteFromArray("cases.au3", $aCases, 1)

I have tested this as much as I can and it works perfectly for me. Try incorporating it into your script and see how it goes. You know where I am if you run into trouble. ;)

M23

P.S. Just do not ask me to rewrite the whole script to make it simpler - you started with this external file concept! :D

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I have tested this with the editcase.au3 file given in post #1 and it works perfectly for me.

Note - When $sSearch = "am" is used, the two Case statements that do not have "am" present in the Case expression are returned from the StringRegExpReplace function.

Local $sFileIn = "editcase.au3"
Local $sSearch = "Simpsons" ; "am" ; "Futurama" ; "Supernatural" ; "American Dad" ;
Local $sFileOut = "editcaseModified.au3"
 
If FileExists($sFileOut) Then FileDelete($sFileOut)
 
; -- Create $sFileOut file without the line with the found $sSearch contents and without the subsequent 4 lines --
FileWrite($sFileOut, StringRegExpReplace(FileRead($sFileIn), "(?im)(^.*case.+?" & $sSearch & ".*\v+(.*\v+){4}\h*\v+)", ""))
 
ShellExecute($sFileOut); Display $sFileOut
Link to comment
Share on other sites

Melba23

Okay first off all thanks allot for the Help(guide) :).

ill try to incorporate it strait away

i must say i am a extremely novice in programming thinking. so that what happens :graduated:

and i will continue on my exsternal file Concept ;)

P.s I would never wont you to rewrite my script as i would never learn and the way i learn is by trial and error.

But i would be nice if you could hint me on the way to what i sould be reading to make the scripting easy'r ;)

Link to comment
Share on other sites

Hey Melba23.

I just inplamenited it to my script and it works:D kind off:P

With some series i have no probleme like simpsons. But series like American Dad and family guy it dos not add the picture/write to the ini file.

I have read through the script a few time and i can't find the problem. and was woundering if you could give it a quick look. thnx in advanced

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author:      Islandspapand
Version:        Beta V.0.2
Script Function:
Popup when new episode avalibale
Check realse date of Series Selected
Send you to a place were you can download (Warez-Torrent-Newsleech)
Send you to EPG site
List last relesead Season
#ce ----------------------------------------------------------------------------
#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListview.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#include <EditConstants.au3>
#include <String.au3>
#include <File.au3>
#include <Array.au3>
#include <Date.au3>
#include <Process.au3>
#include <ProgressConstants.au3>
#include <IE.au3>
#include <GUIExtender.au3>
Global $oIE = _IECreateEmbedded ()
Global $Text = FileRead(@ScriptDir & "\sys\SeriesList.ini")
Global $CaseInfo = "Case ""EDIT"""& @CRLF & _
     "IniWrite($sIni, ""Details"", ""Pic"", @ScriptDir & ""\Sys\ASG-Logo.jpg"")"& @CRLF & _
     "IniWrite($sIni, ""Details"", ""Source"", ""****"")" & @CRLF & _
     "EndSwitch"
    
Global $CaseFile = "$sIni = @ScriptDir &" """\sys\Config.ini""" & @CRLF & _
     "Switch $CmdLine[1]"& @CRLF & _
     "EndSwitch"& @CRLF& _
    
;Folder Exists
If FileExists(@ScriptDir &"\Sys\") Then
Else
DirCreate(@ScriptDir &"\Sys\")
EndIf
;Series List Exists
If FileExists(@ScriptDir &"\Sys\SeriesList.ini") Then
Else
_FileCreate(@ScriptDir &"\Sys\SeriesList.ini")
EndIf
;Config File Exists
If FileExists(@ScriptDir &"\Sys\Config.ini") Then
Else
_FileCreate(@ScriptDir &"\Sys\Config.ini")
EndIf
;Cases File Exists
If FileExists(@ScriptDir &"\Cases.au3") Then
Else
FileWrite(@ScriptDir &"\Cases.au3", $CaseFile)
EndIf
;Pic Exists
If FileExists(@ScriptDir &"\Sys\ASG-Logo.jpg") Then
Else
_FileCreate(@ScriptDir &"\Sys\ASG-Logo.jpg")
EndIf

_ASG()
Func _ASG()
$ASG = GUICreate("Series Guide 2011", 1178, 530, 300, 300)
_GUIExtender_Init($ASG,1)
$FileM = GUICtrlCreateMenu("&File")
$FileMB = GUICtrlCreateMenuItem("Browse", $FileM)
$FileMF = GUICtrlCreateMenuItem("File", $FileM)
$FileME = GUICtrlCreateMenuItem("Exit", $FileM)
$AboutM = GUICtrlCreateMenu("&About")
$AboutM1= GUICtrlCreateMenuItem("About", $AboutM)
$AboutM2 = GUICtrlCreateMenuItem("Help", $AboutM)
$List = GUICtrlCreateList("", 8, 256, 145, 240)
GUICtrlSetData($List, $Text)
$Serielabel = GUICtrlCreateLabel("Series List", 48, 232, 92, 17)
$ADDB = GUICtrlCreateButton("Add New Series", 160, 320, 153, 33)
$DELB = GUICtrlCreateButton("Delete Series", 160, 368, 153, 33)
$DLB = GUICtrlCreateButton("Download", 160, 464, 153, 33)
$GTB = GUICtrlCreateButton("Goto", 160, 416, 153, 33)
$NewRealseLabel = GUICtrlCreateGroup("Newest Realse", 160, 248, 153, 49)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$EpListLabel = GUICtrlCreateGroup("Epiosde List", 336, 8, 145, 489)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pic = GUICtrlCreatePic("", 8, 8, 305, 217)
_GUIExtender_Section_Start(682,682)
_GUIExtender_Section_Action(1)
Global $oIE_1 = _IECreateEmbedded()
Global $hIE_1 = GUICtrlCreateObj($oIE_1, 496, 8, 673, 489)
_GUIExtender_Obj_Data($hIE_1, $oIE_1)
_GUIExtender_Section_End()
_GUIExtender_Section_Extend(1, False)
_GUIExtender_Section_Extend(3, False)
GUISetState(@SW_SHOW)
 
While 1
$nMsg = GUIGetMsg()
Global $Listsel = GUICtrlRead($List)

Switch $nMsg
  Case $GUI_EVENT_CLOSE, $FileME
   Exit
  
  Case $AboutM1
   MsgBox(0,"About","Product Name:    AS-Guide 2011" & _
             @CRLF &"Version:              Beta V 0.2" &@CRLF & _
       @CRLF &"Comments: Thought of by Dejni & Islandspapand" & _
       @CRLF &"Assembeld by Islandspapand with help :D" & _
       @CRLF &"Thanks to all users on Autoit3 Forum for there help Especially M23 ")
  Case $AboutM2
   MsgBox(0,"Help","No Help Yet")
  
  
  Case $GUI_EVENT_RESTORE
   _GUIExtender_Restore()
  Case $GTB
   $searchterm = StringReplace("site:epguides.com " & $Listsel, " ", "+")
   $url = "http://www.google.com/search?hl=en&q=" & $searchterm & "&btnI=I%27m+Feeling+Lucky&aq=f&oq="
   _IENavigate ($oIE_1, $url)
   _GUIExtender_Section_Extend(1, Not(_GUIExtender_Section_State(1)))
 
  Case $DLB
   $url = "http://www.warez-bb.org/search.php"
   _IECreate ($url,0,1,1,1)
 
  Case $DELB
   $szFile = @ScriptDir & "\sys\SeriesList.ini"
   $szText = FileRead($szFile, FileGetSize($szFile))
   $szText = StringReplace($szText,$Listsel & "|", "")
   FileDelete($szFile)
   FileWrite($szFile, $szText)
   Local $aCases
   _FileReadToArray("cases.au3", $aCases)
   $iIndex = _ArraySearch($aCases, 'Case "' & $Listsel & '"', 0, 0, 0, 1)
   For $i = 1 To 3
   _ArrayDelete($aCases, $iIndex)
   Next
   _FileWriteFromArray("cases.au3", $aCases, 1)
   GUICtrlSetData($List, "")
   $TxtR = FileRead($szFile)
   GUICtrlSetData($List, $TxtR)
 
Case $ADDB
      GUISetState(@SW_DISABLE, $ASG)
   _ADDSeries()
   GUISetState(@SW_ENABLE, $ASG)
   GUICtrlSetData($List, "")
   $FileR = @scriptdir & "\Sys\SeriesList.ini"
   $TextR = FileRead($FileR)
   GUICtrlSetData($List, $TextR)
   WinActivate($ASG)
 
 
  Case $List
   RunWait("AutoIt3.exe /AutoIt3ExecuteScript cases.au3 " & GUICtrlRead($List))
   $Picsave = IniRead(@ScriptDir & "\sys\Config.ini", "Details", "Pic", "")
   $source = IniRead(@ScriptDir & "\sys\Config.ini", "Details", "Source", "")
   inetget($source, $Picsave)
   GUICtrlSetImage($Pic, $Picsave)
  
   ;*************Find out how to get Text from EPG and add it to Episode list and New episode******************
   ;$File = @ScriptDir & "\Sys\SerieInfo.ini"
   ;$oIE = _IECreate ("http://epguides.com/AmericanDad/", 0, 0, 1)
   ;$sText = _IEBodyReadText ($oIE)
   ;FileOpen(FileWrite($File, $sText))
   ;FileClose($File)
   ;Global $iInfo
   ;$Araytext = _FileReadToArray($File, $iInfo)
   ;$AraySearch = _ArraySearch($iInfo, "22/May/11",0,0,0,1)
   ;Find date close to date wee are in 3+- days
   ;For $x = 52 to $iInfo[0]
   ;Msgbox(0,'Record:' & $x, $iInfo[$x])
   ;Next
   ;*************Comming Sooooon******************
  
EndSwitch
_GUIExtender_Action($nMsg)
WEnd
EndFunc
Func _AddSeries()
$ADDS = GUICreate("Add Series", 192, 79, 192, 124)
$SeriesName = GUICtrlCreateInput("Input1", 8, 32, 177, 21)
$Label1 = GUICtrlCreateLabel("    Enter Your Series Name Her:", 8, 8, 158, 17)
$OK = GUICtrlCreateButton("OK", 8, 56, 81, 17)
$Cancel = GUICtrlCreateButton("Cancel", 104, 56, 81, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE,$Cancel
   GUIDelete($ADDS)
   ExitLoop

  Case $OK
   $InputRead = GUICtrlRead($SeriesName)
   $searchterm = StringReplace("site:epguides.com " & $InputRead, " ", "+")
   $url = "http://www.google.com/search?hl=en&q=" & $searchterm & "&btnI=I%27m+Feeling+Lucky&aq=f&oq="
   $oIE = _IECreate ($url,0,0)
   $oImg = _IEImgGetCollection ($oIE, 1)
   $sInfo = $oImg.src
   $FileW = @ScriptDir & "\sys\SeriesList.ini"
   FileWrite($FileW,$InputRead & "|")
   $FileRC = @scriptdir & "\cases.au3"
   $RCText = FileRead($FileRC, FileGetSize($FileRC))
   $RCText = StringReplace($RCText,"EndSwitch", "")
   FileDelete($FileRC)
   FileWrite($FileRC, $RCText)
   FileWrite($FileRC, @crlf & $CaseInfo)
   sleep (10)
   $RCText = FileRead($FileRC, FileGetSize($FileRC))
   $RCText = StringReplace($RCText,"EDIT", $InputRead)
   $RCText = StringReplace($RCText,"****", $sInfo)
   FileDelete($FileRC)
   FileWrite($FileRC, $RCText)
   GUIDelete($ADDS)
   ExitLoop
EndSwitch
WEnd
EndFunc
Link to comment
Share on other sites

  • Moderators

islandspapand,

If you have spaces in either @ScriptDir or the input content you need additional quotes for the RunWait to work - try this line and see if it works: ;)

RunWait('AutoIt3.exe /AutoIt3ExecuteScript "' & @ScriptDir & '\cases.au3" "' & GUICtrlRead($List) & '"')

It does for me. :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...