Jump to content
nacerbaaziz

get multiple files selected from the file explorer context menu

Recommended Posts

hi dears, i have a question please
am now working for an audio player for the blind users
and i added an option to open a file from the right click context menu.
but here there is a small problem, i hope that you can help me to find a solution for it.
the problem is as follow :
when i added the problem into the context menu it work with successfuly if the user select just one file.
but if the user selected more then one file, here the problem
a multiple sections of the program will open.
my question is :
how i can detect the multiple selection from the context menu?
i know that it so  hard, but i know also that you are harder than it
for that dears please try to give me an solution for that problem.
thanks in advance

Share this post


Link to post
Share on other sites

Post your script or a reproducer script that works similarly that demonstrates the issue you're having.


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

here is a small example

local $files = ""
if ($cmdLine[0] > 0) then
for $i = 1 to $CMDLine[0]
switch $CMDLine[$i]
case "/play", "-play", "-files"
if not ($i+1 <= $CMDLine[0]) then $files = $CMDLine[$i+1] & "|"
endSwitch
next
if not ($files = "") then
$files = stringSplit($files, "|")
if not (@error) then
$files[0] -= 1
main()
else
exit
endIf
else
main()
endIf

Share this post


Link to post
Share on other sites
10 hours ago, nacerbaaziz said:

There's no suggestion?

You posted a script that is managing command lines, which is definitely far from a context menu.

Post your GUI script.

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

what i need mr is to get the multy files selection from the windows explorer context menu

where this script will added to audio context menu into the file explorer

thx in advanced

Edited by nacerbaaziz

Share this post


Link to post
Share on other sites

@nacerbaaziz I will be glad to help you but you gonna have to help me first by doing 4 simple things.

1- Put your code into Scite and use Tidy to indent your code.  It is unreadable like the way you posted yours.

2- You gonna make a small script to show us what is the exact content of the array $CMDLine you are receiving when selecting multiple files from the File Explorer (use ConsoleWrite to do it)

3- Post the results of the console here along with the code of 1- and 2-

4- Lastly but very important DO NOT call me Dear.  I don't know you.

Share this post


Link to post
Share on other sites

good morning
i return back again

sir
@Nine
am sorry because i told you dear. but we are in arabia using it for respect
and about the array that i want it
so sirs , i hav making an audio player for the blind users, and i added the program into the file explorer context menu of the audio Files
in usually we are using
$CMDLine[$i]
to get the commands line Options
until here all things was good
but if the user selected multiple files here the problem
i tried to use
for $i = 1 to $CMDLine[0]
next
to get all commands Line
but i found that the windows explorer  Send each file alone to the program and multy sections of the program will opened
for that i can't find an way to get all selected files from the context menu
i do it internally by adding an button to open files
but i need the context menu, can any one guide  me to do that please
am waiting for your help

Share this post


Link to post
Share on other sites

@nacerbaaziz Man I will do that easy for you. 

Follow instruction from helpers or dont get help anymore . 

 

@Nine Is a pretty good skilled coder. He asked you 4 things. If you dont do them even me wont try to go further with you. 

 

@Nine This is what i got :! 

local $files = ""
   if ($cmdLine[0] > 0) then
      for $i = 1 to $CMDLine[0]
         switch $CMDLine[$i]
            case "/play", "-play", "-files"
               if not ($i+1 <= $CMDLine[0]) then $files = $CMDLine[$i+1] & "|"
         endSwitch
      next
      if not ($files = "") then
      $files = stringSplit($files, "|")
         if not (@error) then
            $files[0] -= 1
            main()
         else
            exit
         endIf
      else
         main()
      endIf

@nacerbaaziz

This code that you posted got errors. 

 

First thing : main() function is not here ./? 

Second : Your first condition is never ending. Missing EndIf Operator. 

Third thing : As @FrancescoDiMuro said you. You ask somthuing. You show somthing else.

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

You can do it this way:

; Windows Explorer on XP, Vista, 7, 8
$hExplorer = WinGetHandle( "[REGEXPCLASS:^(Cabinet|Explore)WClass$]" )
If Not $hExplorer Then Exit

; Shell object
$oShell = ObjCreate( "Shell.Application" )

; Find window
For $oWindow In $oShell.Windows()
  If $oWindow.HWND() = $hExplorer Then ExitLoop
Next

; Selected items
For $oItem In $oWindow.Document.SelectedItems()
  ConsoleWrite( $oItem.Path() & @CRLF )
Next

 

Share this post


Link to post
Share on other sites

hi sirs
here what i ded
it successfully worked
but here there is an problem
i couldn't know how to let's the script run the main program only ones
it run it more than one section
can any one help me please
here is the code
i tried to folow all what you ded, but am using the code="autoit3" and the /code to post my codes because the code dialog is not accessible with the screen reader
I apologize to you for that.
this file named
shell.exe
and it work is to get the selected files from context menu and send it to my program named easyAudioPlayer.exe
i hope you can help me

#NoTrayIcon
#RequireAdmin
#Region
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Comment=shell manager
#AutoIt3Wrapper_Res_Description=easy Audio Player shell manager
#AutoIt3Wrapper_Res_Fileversion=4.1.0.0
#AutoIt3Wrapper_Res_ProductVersion=4.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=copyright© 2019, by nacer baaziz
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_Field=Productname|easy audio player
#AutoIt3Wrapper_Res_Field=ProductVersiojn|4.0.0.0
#AutoIt3Wrapper_Res_Field=CompanyName|NBSoft
#AutoIt3Wrapper_Res_Field=InternalName|easy Audio Player
#AutoIt3Wrapper_Res_Field=OriginalFilename|shell.exe
#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/mo
#EndRegion
Local $FilesExt = "*.3gp;*.AAC;*.AIFF;*.AMR;*.avi;*.FLAC;*.IT;*.M4A;*.men;*.mid;*.MIDI;*.MO3;*.MOD;*.MP1;*.MP2;*.MP3;*.MP4;*.MTM;*.OGG;*.opus;*.S3M;*.TtA;*.UmX;*.WAV;*.WMA;*.wmv;*.wV;*.Xm"
Local $fullPath
    If $CMDLine[0] = 0 Then
    MsgBox(16, "error", "This application is an internal application." & @CRLF & _
            "Sorry you can not use it as a stand-alone application." & @CRLF & _
            "For more information please contact the developer :" & @CRLF & _
            "Mr. Nacer Baaziz.")
        Exit
ElseIf $cmdLine[0] > 1 Then
    MsgBox(16, "error", "This application is an internal application." & @CRLF & _
            "Sorry you can not use it as a stand-alone application." & @CRLF & _
            "For more information please contact the developer :" & @CRLF & _
            "Mr. Nacer Baaziz.")
    Exit
Else
    If Not (FileExists(@ScriptDir & "\EasyAudioPlayer.exe")) Then Exit
    Local $runingCheck = ProcessList(@ScriptName)
    If Not @error Then
        For $i = 1 To $runingCheck[0][0]
            Local $pathing = $runingCheck[$i][1]
            If Not ($pathing = @AutoItPID) Then
                Exit
            EndIf
        Next
    EndIf
    Local $hExplorer = WinGetHandle("[REGEXPCLASS:^(Cabinet|Explore)WClass$]")
    If Not ($hExplorer) Then
        ShellExecute(@ScriptDir & "\EasyAudioPlayer.exe", $CmdLineRaw, @WorkingDir & "\")
        Exit
    Else
        Local $oShell = ObjCreate("Shell.Application")
        For $oWindow In $oShell.Windows()
            If $oWindow.HWND() = $hExplorer Then ExitLoop
        Next
        Local $iSelected = 0, $sSelected = "", $LastSelected = ""
        For $oItem In $oWindow.Document.SelectedItems()
            If ($iSelected > 0) Then
                If StringInStr($oItem.Path(), " ") Then
                    $sSelected &= '"' & $oItem.Path() & '"' & "|"
                Else
                    $sSelected &= $oItem.Path() & "|"
                EndIf
                $iSelected += 1
            Else
                If StringInStr($oItem.Path(), " ") Then
                    $LastSelected = '"' & $oItem.Path() & '"'
                Else
                    $LastSelected = $oItem.Path()
                EndIf
                $iSelected += 1
            EndIf
        Next
        If ($iSelected = 1) Then
            $sSelected = $LastSelected
            ShellExecute(@ScriptDir & "\EasyAudioPlayer.exe", "-play " & $sSelected, @WorkingDir & "\")
        ElseIf ($iSelected > 1) Then
            $sSelected &= $LastSelected
            ShellExecute(@ScriptDir & "\EasyAudioPlayer.exe", "-play " & $sSelected, @WorkingDir & "\")
        EndIf
    EndIf
EndIf
Exit


thanks in advanced

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

  • Similar Content

    • By Irios
      I have several context menus that's been built using _GUICtrlMenu_CreatePopup() and _GUICtrlMenu_AddMenuItem().
      When using _GUICtrlMenu_CreatePopup() it returns the identifier of the clicked item, sure. But it blocks the main loop while the menu is open.
      When using _GUICtrlMenu_CreatePopup($MNS_MODELESS) it returns immediately (of course), but I cannot figure out how/where to read the item that was clicked. Is there a Windows Message (WM) somewhere that is triggered? I've spend an entire day trying to figure out how to do this, but I'm not getting anywhere. My google fu is depleted (I must have tried like hundreds of script variations today), I'm about to smash my keyboard and just go to bed, and abandon the entire endeavor of making pretty menus and go back to using Koda and forget about using menu icons, colors,  etc.
      Anyone wanna help me out with how to read the clicked item? Before I smash my keyboard, please...
       
      Example script here:
       
      #include <GuiMenu.au3> #include <WinAPIError.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> GUIRegisterMsg($WM_CONTEXTMENU, "_WM_CONTEXTMENU") Global $idMenuItem = 10000, $counter = 0 Global $hGUI = GUICreate("Menu test", 400, 300) Global $hListview = GUICtrlCreateListView("", 2, 2, 396, 200) GUISetState(@SW_SHOW) ;~ Global $hMenuContext = _GUICtrlMenu_CreatePopup() Global $hMenuContext = _GUICtrlMenu_CreatePopup($MNS_MODELESS) _GUICtrlMenu_AddMenuItem($hMenuContext, "Menu item", $idMenuItem) Global $hTimer = TimerInit() Do If TimerDiff($hTimer)>200 Then $counter += 1 ConsoleWrite($counter & " " ) $hTimer = TimerInit() EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE Exit Func _WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case GUICtrlGetHandle($hListview) ConsoleWrite( @CRLF & "_GUICtrlMenu_TrackPopupMenu = " & _GUICtrlMenu_TrackPopupMenu($hMenuContext, $wParam, -1, -1, 1, 1, 2) & @CRLF) EndSwitch EndFunc  
       
    • By Scriptmaster
      <NEWBIE ALERT>
      Is it possible to unzip a zip file in Autoit without using a dll!
      My script downloads a zip file to a temporary directory (successfully) and it must be unzipped to (Or moved to after unzip) another a folder which just happens to be
      @scriptdir & "file.exe" Thanks in advance
    • By Inpho
      Hi All,
      I intend on keeping custom functions/UDFs (works in progress) here; if anyone wants to use any code, feel free.
      String functions:
      #AutoIt3Wrapper_AU3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DateTimeGet ; Description ...: Returns the date and time formatted for use in sortable filenames, logs, listviews, etc. ; Syntax ........: _DateTimeGet(iType = 1[, $bHumanFormat = False]) ; Parameters ....: $iType - [optional] an integer value. Default is 1. ; 1 - Date and time in file-friendly format; 20190115_113756 ; 2 - Date in file-friendly format; 20190115 ; 3 - Time in file friendly format; 113756 ; $bHumanFormat - [optional] a boolean value. Default is False. ; True - Includes slashes in the date and colons in the time with a space inbetween ; False - No slashes or colons included with an underscore inbetween ; Return values .: Success - String ; Failure - Sets @error to non-zero and returns an empty string ; Author ........: Sam Coates ; =============================================================================================================================== Func _DateTimeGet($iType = 1, $bHumanFormat = False) If $iType < 1 Or $iType > 3 Then Return (SetError(-1, 0, "")) ;; Param1: ;; 1 = Date and time in file friendly format: 20190115_113756 ;; 2 = Date in file friendly format: 20190115 ;; 3 = Time in file friendly format: 113756 ;; Param2: ;; True = Use human-readable format: 15/01/2019 11:37:56 Local $sTime = @HOUR & ":" & @MIN & ":" & @SEC Local $sDate = @MDAY & "/" & @MON & "/" & @YEAR If $iType = 1 Then If $bHumanFormat = False Then $sTime = StringReplace($sTime, ":", "") $sDate = StringReplace($sDate, "/", "") $sDate = StringTrimLeft($sDate, 4) & StringMid($sDate, 3, 2) & StringLeft($sDate, 2) Return ($sDate & "_" & $sTime) Else Return ($sDate & " " & $sTime) EndIf ElseIf $iType = 2 Then If $bHumanFormat = False Then $sDate = StringReplace($sDate, "/", "") $sDate = StringTrimLeft($sDate, 4) & StringMid($sDate, 3, 2) & StringLeft($sDate, 2) EndIf Return ($sDate) ElseIf $iType = 3 Then If $bHumanFormat = False Then $sTime = StringReplace($sTime, "/", "") EndIf Return ($sTime) EndIf EndFunc ;==>_DateTimeGet ; #FUNCTION# ==================================================================================================================== ; Name ..........: _FileToFileExtension ; Description ...: Returns a file extension from a filename/FQPN (Fully Qualified Path Name) ; Syntax ........: _FileToFileExtension($sPath) ; Parameters ....: $sPath - a string value. ; Return values .: Success - String ; Failure - Empty string as returned from StringTrimLeft() ; Author ........: Sam Coates ; =============================================================================================================================== Func _FileToFileExtension($sPath) Return (StringTrimLeft($sPath, StringInStr($sPath, ".", 0, -1))) EndFunc ;==>_FileToFileExtension ; #FUNCTION# ==================================================================================================================== ; Name ..........: _FileToFileName ; Description ...: Returns a filename from a FQPN (Fully Qualified Path Name) ; Syntax ........: _FileToFileName($sPath[, $bIncludeExtension = True]) ; Parameters ....: $sPath - a string value. ; $bIncludeExtension - [optional] a boolean value. Default is True. ; Return values .: Success - String ; Failure - Empty string as returned from StringLeft() ; Author ........: Sam Coates ; =============================================================================================================================== Func _FileToFileName($sPath, $bIncludeExtension = True) Local $sReturn = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1)) If $bIncludeExtension = False Then $sReturn = StringLeft($sReturn, StringInStr($sReturn, ".", 0, -1) - 1) Return ($sReturn) EndFunc ;==>_FileToFileName ; #FUNCTION# ==================================================================================================================== ; Name ..........: _FileToFilePath ; Description ...: Returns a folder path from a FQPN (Fully Qualified Path Name) ; Syntax ........: _FileToFilePath($sPath) ; Parameters ....: $sPath - a string value. ; Return values .: Success - String ; Failure - Empty string as returned from StringLeft() ; Author ........: Sam Coates ; =============================================================================================================================== Func _FileToFilePath($sPath) Return (StringLeft($sPath, StringInStr($sPath, "\", 0, -1) - 1)) EndFunc ;==>_FileToFilePath ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringLeft ; Description ...: Searches for a string inside a string, then removes everything on the right of that string ; Syntax ........: _StringLeft($sString, $sRemove[, $iCaseSense = 0, $iOccurrence = 1]) ; Parameters ....: $sString - a string value. The string to search inside. ; $sRemove - a string value. The string to search for. ; $iCaseSense - an integer value. Flag to indicate if the operations should be case sensitive. ; $iOccurrence - an integer value. Which occurrence of the substring to find in the string. Use a ; negative occurrence to search from the right side. ; Return values .: Success - String ; Failure - Empty string as returned from StringLeft() ; Author ........: Sam Coates ; =============================================================================================================================== Func _StringLeft($sString, $sRemove, $iCaseSense = 0, $iOccurrence = 1) Return (StringLeft($sString, StringInStr($sString, $sRemove, $iCaseSense, $iOccurrence) - 1)) EndFunc ;==>_StringLeft ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringRandom ; Description ...: Returns a string of random characters ; Syntax ........: _StringRandom($iAmount[, $iType = 1]) ; Parameters ....: $iAmount - an integer value. Length of returned string ; $iType - [optional] an integer value. Default is 1. ; 1 - Return digits (0-9) ; 2 - Return hexadecimal (0-9, A - F) ; 3 - Return Alphanumeric upper (0-9, A - Z) ; 4 - Return Alphanumeric (0-9, A - Z, a - z) ; 5 - Return Alpha upper (A - Z) ; 6 - Return Alpha (A - Z, a - z) ; Return values .: Success - String ; Failure - Empty string and @error flag as follows: ; @error : 1 - $iAmount is not a positive integer ; 2 - $iType is out of bounds ; Author ........: Sam Coates ; =============================================================================================================================== Func _StringRandom($iAmount, $iType = 1) If $iAmount < 1 Or IsInt($iAmount) = 0 Then Return (SetError(-1, 0, "")) Local $sString = "" Local $iRandomLow = 1, $iRandomHigh = 62 #Tidy_Off Local Static $aCharId[63] = [0, Chr(48), Chr(49), Chr(50), Chr(51), Chr(52), Chr(53), Chr(54), Chr(55), Chr(56), Chr(57), Chr(65), Chr(66), Chr(67), _ Chr(68), Chr(69), Chr(70), Chr(71), Chr(72), Chr(73), Chr(74), Chr(75), Chr(76), Chr(77), Chr(78), Chr(79), Chr(80), _ Chr(81), Chr(82), Chr(83), Chr(84), Chr(85), Chr(86), Chr(87), Chr(88), Chr(89), Chr(90), Chr(97), Chr(98), Chr(99), _ Chr(100), Chr(101), Chr(102), Chr(103), Chr(104), Chr(105), Chr(106), Chr(107), Chr(108), Chr(109), Chr(110), Chr(111), _ Chr(112), Chr(113), Chr(114), Chr(115), Chr(116), Chr(117), Chr(118), Chr(119), Chr(120), Chr(121), Chr(122)] #Tidy_On If $iType = 1 Then ;; digits: 1 - 10 $iRandomHigh = 10 ElseIf $iType = 2 Then ;; hexadecimal: 1 - 16 $iRandomHigh = 16 ElseIf $iType = 3 Then ;; alnumupper: 1 - 36 $iRandomHigh = 36 ElseIf $iType = 4 Then ;; alnum: 1 - 62 $iRandomHigh = 62 ElseIf $iType = 5 Then ;; alphaupper: 11 - 36 $iRandomLow = 11 $iRandomHigh = 36 ElseIf $iType = 6 Then ;; alpha: 11 = 62 $iRandomLow = 11 $iRandomHigh = 62 Else Return (SetError(-2, 0, "")) EndIf For $i = 1 To $iAmount $sString &= $aCharId[Random($iRandomLow, $iRandomHigh, 1)] ;; append string with corresponding random character from ascii array Next Return ($sString) EndFunc ;==>_StringRandom ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringTrimLeft ; Description ...: Searches for a string inside a string, then removes everything on the left of that string ; Syntax ........: _StringTrimLeft($sString, $sRemove[, $iCaseSense = 0, $iOccurrence = 1]) ; Parameters ....: $sString - a string value. The string to search inside. ; $sRemove - a string value. The string to search for. ; $iCaseSense - an integer value. Flag to indicate if the operations should be case sensitive. ; $iOccurrence - an integer value. Which occurrence of the substring to find in the string. Use a ; negative occurrence to search from the right side. ; Return values .: Success - String ; Failure - Empty string as returned from StringTrimLeft() ; Author ........: Sam Coates ; =============================================================================================================================== Func _StringTrimLeft($sString, $sRemove, $iCaseSense = 0, $iOccurrence = 1) Return (StringTrimLeft($sString, StringInStr($sString, $sRemove, $iCaseSense, $iOccurrence) + StringLen($sRemove) - 1)) EndFunc ;==>_StringTrimLeft Examples:
      ConsoleWrite(_StringRandom(100, 6) & @CRLF) ConsoleWrite(_StringTrimLeft("C:\Windows\System32\cmd.exe", "C:\Windows\System32\") & @CRLF) ConsoleWrite(_StringLeft("C:\Windows\System32\cmd.exe", "cmd.exe") & @CRLF) ConsoleWrite(_FileToFileName("C:\Windows\System32\cmd.exe") & @CRLF) ConsoleWrite(_FileToFilePath("C:\Windows\System32\cmd.exe") & @CRLF) ConsoleWrite(_FileToFileExtension("C:\Windows\System32\cmd.exe") & @CRLF) ConsoleWrite(_StringRandom(6, 4) & "-" & _StringRandom(4, 4) & "-" & _StringRandom(4, 4) & "-" & _StringRandom(4, 4) & "-" & _StringRandom(6, 4)& @CRLF)  
    • By dinotom
      Can files be read from the web or the cloud?
      I am trying to read this file but get the file open error.
      #include <FileConstants.au3> #include <MsgBoxConstants.au3> ;Assign the file path to a variable Local $sFilePath = "C:\Automation\test.txt" Local $sFilePathAzure ="https://batlgroupimages.blob.core.windows.net/files/test.txt" Local $nLineNumberToLookFor = 0 ;Open the file test.txt in append mode. ;If the folder C:\Automation does not exist, it will be created. Local $hFileOpen = FileOpen($sFilePathAzure, $FO_APPEND + $FO_CREATEPATH) ;Display a message box in case of any errors. If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred while opening the file.") EndIf ;Set the file position to beginning for reading the data from the beginning of the file. FileSetPos($hFileOpen, 0, $FILE_BEGIN) ;Read the data from the file using the handle returned by FileOpen ;Local $sFileRead = FileRead($hFileOpen) ;Read the 2nd line of data from the file using the handle returned by FileOpen Local $sFileReadLine = FileReadLine ($hFileOpen,2) ;Close the handle returned by FileOpen. FileClose($hFileOpen)  
×
×
  • Create New...