Jump to content

Recommended Posts

Remote Gmail UDF


Working
It uses the Google atom API to get the Summary of the mail,
The Summary of the mail is enough to get a direct link or a single function with parameters
Execute any Function (or Script) and get the Return Values in your E-mail

Requirements

  • Gmail (Email) Account
  • A Remote Computer with Internet Access

Representation
remotegmail.png
Functions

  • You can now use you Gmail account to use Autoit Functions in a remote computer
  • Can execute a function through reading the email.
  • Can Email back the return values of an executed function.
  • The parameter can even be a variable present in the script [see Syntax]
  • Execute a Script through Direct Link.
  • Execute multiple scripts zipped together through Direct Link.
  • Can Email back the PID of the running executables with the scripts.
  • Attach any file and get it in your email.
  • Able to send the multiple attachments zipped together.
  • Writes all the return values in a Log file.
  • No email is executed twice, the Message IDs are stored for this purpose.

Future Updates

  • Support single line nesting
  • Get the attachment, to execute the script

Syntax

Syntax for Functions
PXL<FuncName>: (<data type>)<first param part a>+(<data type>)<first param part b>|(<data type>)<secondparam>/PXL

Colon[:] - Separation of Function Name with the Parameters
Bar [ | ] - Separation of different parameters
Plus [+] - To Concatenate Values
PXL /PXL - The tags where the code is enclosed
Brackets [ () ] - For specifying the type of the parameter

DataTypes - Always Preceded by any parameter and are enclosed with brackets

; | (s) - String
; | (n) - Number
; | (f) - Floating Number
; | (i) - Integer
; | (b ) - Binary
; | (v) - Variable
; | (h) - Hex
; | (m) - macro
; | (w) - Handle
; | (p) - Pointer


Syntax for Direct Links
PXL<DirectLink>^<Type>/PXL

PXL /PXL - The tags where the code is enclosed
Caret [ ^ ] - To Separate the Link and the Type
Type - Either Zip or au3

DirectLink WebServer
Some of webservers providing Direct Links
DropBox [Tested - Recommended]
Herosh [Tested]*
FileToLink
FileDen

* DirectLink from Herosh changes therefore Example 4 wont work after a while

Credits
CaptainClucks - Atom Feed
Jos - SMTP Mailer
wraithdu - Zip UDF

Change Log
v1.0 - First Release
v1.1 - Added Script Execution with Zipping Functionality
v1.2 - Fixed some Minor bugs
v1.3 - Added RemoteGmail_Startup
v1.4 - Fixed Compiling Issues

v1.5 - Added flexibility for execution of scripts from any email.

The UDF - Download
The UDF is currently tested on x86
All Comments ,Queries , Feedback and Advice are welcomed... :)
The UDF with the Examples have been compiled in the following Zip

v1.5 RemoteGmail.7z
Previous Downloads : 1119

Regards
Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

24 Downloads yet no Reply

Please give me Feedback and Suggestions

Regards

Phoenix XL


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

hI, GREAT IDEA, you can have a look AT mine here, similar THAN yours, but using a mysql db instead, it includes also a browser link to work for starting the script from an IPHONE-ANDROID smartphone --> INTO a autoit APP Client(via php and mysql and this remote Autoit app client)

I write there a link also for another internet "automator".

I posted your script-link in our Autoit SPANISH SUPPORT GROUP FORUM HERE:

LINK

THANKS

SALUDOS

PD: España-France Football MATch IS tomorrow.

Edited by BasicOs

Share this post


Link to post
Share on other sites

v1.1 has been released

Check the First Post


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

hI, GREAT IDEA

Thanks BasicOS :) Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

thanks CptSpike :graduated:

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

oops forgot to add the script.. :rolleyes:

.

.

please check the first post


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Hi Phoenix, a good tool for administering network remotely. I downloaded, but could not understand how to go configuring remote computers and put them in to listening mode.

Is there any help file showing how to start?

Share this post


Link to post
Share on other sites

This will help you achieve a continuous loop to check and execute the emails till the compter isnt turned off or the Process isnt killed

;For Version 1.2 only
;Check Continuously
Opt('TrayIconDebug', 1)


Global $sUsername = 'myusername' ; Your Username for Example if phoenixxl@gmail.com is your Gmail Address then phoenixxl would be your username
Global $sPassword = '********' ; Your Password for your Gmail Account
Global $iTimeOut = 12000
#include <RemoteGmail.au3>

;The Function would be executed every 12 Seconds.
;Hence all the New mails would be checked and executed every 12000 milli Seconds
AdlibRegister('RemoteGmail',$iTimeOut)

;Our Infinite Loop
While 1
Sleep(10)
WEnd

Just give your username and password

Send yourself an email with your email address and get the script or Function executed

One more tip : to execute the mails when user goes idle check Idle Process in my Signature

Regards

Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Hello Pheonix

I found a bug; it's in the part where _ExecuteFromEmail function is calling _GetfromDirectLink function; first parameter contains the ^zip in it so the link is incorrect; _GetfromDirectLink function do'nt catch the error, so _ExecuteFromEmail crashes because $nArrays is not a array. My correction (simplest for me) was this:

Local $nFile = GetfromDirectLink(StringTrimRight($sExecute, 4), @ScriptDir &amp; 'Temp.' &amp; $nType)

Anyway, great job, i was using a script similar with this, but yours is much better; thank you, and maybe we'll expand it; I have some ideas, but I will post them later.

Thanks , Paul

edit: sorry for my bad english

Edited by kiu

Share this post


Link to post
Share on other sites

Thanks kiu,

I have updated the UDF

please check the first post


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

When I try to start any code i get error from string.au3

Func _HexToString($strHex)

If StringLeft($strHex, 2) = "0x" Then Return BinaryToString($strHex)

Return BinaryToString("0x" & $strHex)

EndFunc ;==>_HexToString

Its says that missing wend, endswitch. I try to change something and I get errors from remotegmail.au3 .

I make ant imput box with button. I want to put there text, click button and get text into gmail .

Share this post


Link to post
Share on other sites

Such messages are (most of the time) not caused by the UDF but by the user code missing a closing quote or something like that.

Running Tidy has often shown where the problem is.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-13 - Version 0.5.0.0) - Download - General Help & Support - 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

Just tried your script you sent me by PM and it works fine. Autoit 3.3.8.1, latest GMail UDF. Running on Windows 7 64 bit.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-13 - Version 0.5.0.0) - Download - General Help & Support - 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

Can you post the output of the SciTE console pane? Which error messages do you get there? Line number etc?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-13 - Version 0.5.0.0) - Download - General Help & Support - 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

C:Documents and SettingsxxxxDesktopRemoteGmailv1.2 RemoteGmailRemoteGmail.au3(10,29) : WARNING: $sUsername: possibly used before declaration.
Global $sEmail = $sUsername &
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:Documents and SettingsxxxxDesktopRemoteGmailv1.2 RemoteGmailRemoteGmail.au3(60,53) : WARNING: $sPassword: possibly used before declaration.
Local $eReturn = _CheckGmail($sUsername, $sPassword,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:Documents and SettingsxxxxDesktopRemoteGmailv1.2 RemoteGmailTest.au3 - 0 error(s), 2 warning(s)
->13:41:40 AU3Check ended. Press F4 to jump to next error.rc:1
>Running:(3.3.8.1):C:Program FilesAutoIt3autoit3.exe "C:Documents and SettingsxxxxDesktopRemoteGmailv1.2 RemoteGmailTest.au3"
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
C:Documents and SettingsxxxxDesktopRemoteGmailv1.2 RemoteGmailRemoteGmail.au3 (10) : ==> Variable used without being declared.:
Global $sEmail = $sUsername & '@gmail.com'
Global $sEmail = ^ ERROR
->13:41:40 AutoIT3.exe ended.rc:1
>Exit code: 1 Time: 2.618
You access a variable ($sUsername) before it has been declared. Move the variable declaration/assignment to the top of your script (before the GMail include) and the error should go away:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sUsername = "myemail"
Global $sPassword = "password"
Global $texttosend

#include <RemoteGmail.au3>

#region ### START Koda GUI section ### Form=
GUICreate("Test", 300, 72, 296, 260)
$Input1 = GUICtrlCreateInput("Put some text", 8, 8, 281, 21)
$send = GUICtrlCreateButton("Send Gmail", 8, 32, 283, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
          Exit
        Case $send
            $texttosend = GUICtrlRead($Input1)
            SendEmail2Gmail($texttosend, '', 0, 'Execute')
    EndSwitch
WEnd
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-13 - Version 0.5.0.0) - Download - General Help & Support - 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

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  

  • Similar Content

    • By ozymandius257
      This is probably a very simple question (I hope!)
      I'm looking to use a UDF to access a SQL database, and have found ADO.au3, but I can't seem to work out how to use it.
      I've copied the files ado.au3 and ado_constants.au3 into the folder C:\Program Files (x86)\AutoIt3\Include, then opened SciTe and started a new project.
      But when I type #include<AD - I don't get offered ADO.au3.
      (I know I should be using the folder C:\Program Files (x86)\AutoIt3\UserInclude, but when it didn't work from there, I tried the above).
      What am I doing wrong?
       
    • By nacerbaaziz
      hello sirs, please i created a tool witch get the focused control in a window and play a audio file linked with this controls
      e.g buttons, checkBoxes, radios, comboboxes, and others
      i know that their is a function that give us the control focus but it return the classNN
      i want to get the class name to use it with a switch and
      because their are more than class e.g button tbutton timagebutton tnewButton...
      please can any one help me to get the class name not the classnn
      thanks in advance
    • By BetaLeaf
      What is Rollbar?
      Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/
      Demo: https://rollbar.com/demo/demo/
      Screenshot:
      Instructions: (RollbarTest.au3)
      ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. 
      Right now, it is fully functional but not tested in production.
       
       
      Changelog:
      RollbarSDK.au3
      RollbarTest.au3
      v0.2
       
      v0.1.1
       
    • By t0nZ
      I was in a hurry to convert 200+ address book from Google Contacts (G Suite, contacts exported in .CSV with Google Takeout, but the contact format is the same for every Google Gmail account)  to Outlook contacts, so I developed this quick and very dirty script.
      Starting from a .CSV exported from Google, you can run the script and you have the contacts ported directly (no outlook import) on the Outlook Address book.
      In my experience, the fields of Google contacts are not fixed in number  and maybe also in position, so I made the choice  to import only certain fields to Outlook, scanning every line.
      These fields, exact google names:
              "Given Name"  
              "Family Name"  
              "E-mail 1 - Value"  
              "E-mail 2 - Value"  
              "Phone 1 - Value"  
              "Phone 2 - Value"  
              "Website 1 - Value" 
              "Notes"  
              "Name"  
              "Address 1 - Formatted"  
      Also the lines of google contacts can be weird as CR and LF are not "regular".
      I include my code, (worked with no errors on a lot of conversions) and also a very small fake adress book with examples of problems I encountered and resolved.
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icone\Win98-ico\script_file_teal.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;GOA2OAB ;G.oogle A.ddress B.ook 2 (to) O.utlook A.ddress B.ook ;(C) NSC 2019 ; convert a google (takeout) address book to an Outlook Address Book #include <File.au3> #include <Array.au3> #include <_Gollog.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <String.au3> #include <Math.au3> ; ***************************************************************************** #include <OutlookEX.au3> ; super perla pearl outlook create contacts !!!!! ; ***************************************************************************** Global $oItem Global $oOutlook = _OL_Open() If @error <> 0 Then MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; ***************************************************************************** Global $ver = "V.0.8192", $tempdir = "c:\GAB2OAB_temp", $File2convert, $aRetArray, $workfile = $tempdir & "\work-GAB2OAB.csv", $workfile2 = $tempdir & "\WORK2-gab2oab.csv", $FINALab = $tempdir & "\NEW-ab.csv", $A3clean[0], $A4clean[0], $A5clean[0] ; Gollog Autogenerated Gui $mygui = "G.oogle A.ddress B.ook 2 (to) O.utlook A.ddress B.ook " & $ver & " NSC 2019" gollog_ini($mygui, 600, 200, 50, 50, "0x0033cc", "0xA8D9BD", "courier", 8, 600, @ScriptDir & "\GAB2OAB_log.txt") ; initialization with colors and font choice, more options see the UDF Gollog(">>>>>>>> GAB2OAB " & $ver) $File2convert = FileOpenDialog("Select Google Address Book File", @DesktopDir & "\", "CSV (*.csv)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) Gollog("selected " & $File2convert) If Not FileExists($tempdir) Then Gollog("creating " & $tempdir) DirCreate($tempdir) EndIf If FileExists($workfile) Then Gollog("deleting " & $workfile) FileDelete($workfile) EndIf If FileExists($workfile2) Then Gollog("deleting " & $workfile2) FileDelete($workfile2) EndIf If FileExists($FINALab) Then Gollog("deleting " & $FINALab) FileDelete($FINALab) EndIf cleanfile() readfile() cleanfile2() readfile2() write2Outlook() Exit Func write2Outlook() Gollog("---> Assigning Fields...") Sleep(300) Local $FirstName = 4 ; initialize with Yomi name - always empty in tested companies, low class workaround Local $LastName = 4 Local $Email1Address = 4 Local $Email2Address = 4 Local $MobileTelephoneNumber = 4 Local $OtherTelephoneNumber = 4 Local $Webpage = 4 Local $Body = 4 Local $Fullname = 4 Local $BusinessAddress = 4 For $z = 0 To UBound($A5clean, 2) - 1 ;If $A5clean[2][$z] = "Additional Name" Then $MiddleName = $z ; limit @ 10 If $A5clean[1][$z] = "Given Name" Then $FirstName = $z If $A5clean[1][$z] = "Family Name" Then $LastName = $z If $A5clean[1][$z] = "E-mail 1 - Value" Then $Email1Address = $z If $A5clean[1][$z] = "E-mail 2 - Value" Then $Email2Address = $z If $A5clean[1][$z] = "Phone 1 - Value" Then $MobileTelephoneNumber = $z If $A5clean[1][$z] = "Phone 2 - Value" Then $OtherTelephoneNumber = $z If $A5clean[1][$z] = "Website 1 - Value" Then $Webpage = $z If $A5clean[1][$z] = "Notes" Then $Body = $z If $A5clean[1][$z] = "Name" Then $Fullname = $z If $A5clean[1][$z] = "Address 1 - Formatted" Then $BusinessAddress = $z Next Gollog("Fields Found !") For $i = 2 To UBound($A5clean, 1) - 1 Gollog("Contact 2 Outlook line " & $i) ;Gollog($A5clean[$i][1]) ; Create a contact with first- and lastname ; ***************************************************************************** $oItem = _OL_ItemCreate($oOutlook, $olContactItem, "", "", "FullName=" & $A5clean[$i][$Fullname], "BusinessAddress=" & $A5clean[$i][$BusinessAddress], "FirstName=" & $A5clean[$i][$FirstName], "LastName=" & $A5clean[$i][$LastName], "Email1Address=" & $A5clean[$i][$Email1Address], "Email2Address=" & $A5clean[$i][$Email2Address], "WebPage=" & $A5clean[$i][$Webpage], "MobileTelephoneNumber=" & $A5clean[$i][$MobileTelephoneNumber], "OtherTelephoneNumber=" & $A5clean[$i][$OtherTelephoneNumber], "Body=" & $A5clean[$i][$Body]) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate ", "Error creating a contact'. @error = " & @error & ", @extended = " & @extended) ; Add a picture to the contact ;$oItem.AddPicture(@ScriptDir & "\The_Outlook.jpg") $oItem.Save() ; ***************************************************************************** Next MsgBox(64, "OutlookEX UDF: the magic was made!", "All contacts successfully created ") _OL_Close($oOutlook) ; close the connection to Outlook EndFunc ;==>write2Outlook Func cleanfile() Gollog('start check for unwanted LF... / final rogue "') Sleep(300) Local $A2Clean = FileReadToArray($File2convert) ;_ArrayDisplay($A2Clean, "original file", Default, 8) Local $dimLIST = UBound($A2Clean) - 1 Local $string2write = "" Local $Astring1 = "" Local $Astring2 = "" Local $salvaAstring1 = "" Local $openLF = 0 ; we are between "LF" across lines For $i = 0 To $dimLIST Gollog('workin on line ' & $i) ;Gollog($A2Clean[$i]) $Astring1 = StringToASCIIArray($A2Clean[$i]) ;_ArrayDisplay($Astring1) Local $DimAstring1 = UBound($Astring1) - 1 If $openLF = 1 Then ;check new line if start with " $Astring2 = StringToASCIIArray($A2Clean[$i]) If $Astring2[0] = "34" Then ; gollog('found initial " ') $openLF = 2 Else Gollog('error new line not starting with "') MsgBox(48, "error", 'error new line not starting with "') EndIf EndIf If $Astring1[$DimAstring1] = "34" Then ; gollog('First line -> Found final "') If $openLF <> 0 Then $salvaAstring1 = $salvaAstring1 & $A2Clean[$i] Else $salvaAstring1 = $A2Clean[$i] EndIf Else _ArrayAdd($A3clean, $salvaAstring1 & $A2Clean[$i]) ;Gollog("adding to cleaned array state:" & $openLF) $openLF = 0 $salvaAstring1 = "" EndIf Next Gollog('end clean from rogue "') ;_ArrayDisplay($A3clean, 'cleaned from rogue "') ;___________________________________P-PP-PP,P------------------------------------------------- Gollog('Start joining lines based on ODD " ') Sleep(300) ;_MathCheckDiv ( $iNum1 [, $iNum2 = 2] ) pari e dispari perla pearl Local $hFileOpen = FileOpen($workfile2, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the file.") Return False EndIf Local $dimLIST = UBound($A3clean) - 1 Local $Astring1 = "" Local $Astring2 = "" Local $dimSTRING = "" Local $AapiciINriga Local $numeroapiciINriga = 0 Local $sommaNumeroapiciINrighe = 0 Local $salvaAstring1 = "" Local $dispari = 0 For $i = 0 To $dimLIST Gollog("workin' on line " & $i) $Astring1 = StringToASCIIArray($A3clean[$i]) ;_ArrayDisplay($Astring1) ;Gollog($A3clean[$i]) $AapiciINriga = _ArrayFindAll($Astring1, '34') If $AapiciINriga <> -1 Then $numeroapiciINriga = UBound($AapiciINriga) ; Gollog("N° " & $numeroapiciINriga & " apici in riga " & $i) $sommaNumeroapiciINrighe += $numeroapiciINriga If _MathCheckDiv($sommaNumeroapiciINrighe) = 1 Then $salvaAstring1 = $salvaAstring1 & $A3clean[$i] $dispari = 1 Else Local $towrite = $salvaAstring1 & $A3clean[$i] ; gollog("scrivo " & $towrite) FileWriteLine($hFileOpen, $towrite) $salvaAstring1 = "" $sommaNumeroapiciINrighe = 0 $dispari = 0 EndIf Else ; Gollog("zero apici in riga " & $i) If $dispari = 1 Then ;linea vuota o senza apici ma " aperte dispari $salvaAstring1 = $salvaAstring1 & $A3clean[$i] Else Local $towrite = $salvaAstring1 & $A3clean[$i] ; gollog("scrivo " & $towrite) FileWriteLine($hFileOpen, $towrite) $salvaAstring1 = "" $sommaNumeroapiciINrighe = 0 $dispari = 0 EndIf EndIf Next Gollog('END joined lines based on ODD "') ;_ArrayDisplay($A4clean, 'joined lines based on ODD "') FileClose($hFileOpen) EndFunc ;==>cleanfile Func readfile() gollog("reading work file and creating multiD array") Sleep(300) $A4clean = FileReadToArray($workfile2) If @error = 1 Or @error = 2 Then gollog("error reading work2 file " & @error) Else ; _ArrayDisplay($A4clean, "cleaned 1", Default, 8) EndIf EndFunc ;==>readfile Func cleanfile2() Local $dimLIST = UBound($A4clean) - 1 Local $Astring1 = "" Local $conta = 0 Local $salvaconta = 0 Local $dimSTRING = "" $salvalinea = "" Local $standardNumeroVirgole = 0 Local $hFileOpen = FileOpen($FINALab, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the file.") Return False EndIf Gollog('Checkin , number') For $i = 0 To $dimLIST ;Gollog('workin on line ' & $i) $Astring1 = StringToASCIIArray($A4clean[$i]) ;_ArrayDisplay($Astring1) $dimSTRING = UBound($Astring1) - 1 For $y = 0 To $dimSTRING If $Astring1[$y] = "44" Then ; secondo step , $conta += 1 EndIf Next If $i = 0 Then $standardNumeroVirgole = $conta gollog("----------numero virgole -> " & $standardNumeroVirgole) EndIf If $conta = $standardNumeroVirgole Then FileWriteLine($hFileOpen, $A4clean[$i]) EndIf If $conta > $standardNumeroVirgole Then Gollog('>>> Line ' & $i & ' Virgole' & $conta) $toprecise = $A4clean[$i] $tofinal = '' While StringInStr($toprecise, '"') <> 0 $tofinal = preciseremoval($toprecise) ;super smart $toprecise = $tofinal WEnd FileWriteLine($hFileOpen, $toprecise) EndIf If $conta < $standardNumeroVirgole Then Gollog('<<< Line ' & $i & ' Virgole' & $conta) $salvalinea = $salvalinea & $A4clean[$i] $salvaconta += $conta If $salvaconta = $standardNumeroVirgole Then $salvaconta = 0 FileWriteLine($hFileOpen, $salvalinea) $salvalinea = 0 EndIf EndIf $conta = 0 Next FileClose($hFileOpen) EndFunc ;==>cleanfile2 Func writeWORKfile2() Gollog("writing work file") If _FileWriteFromArray($workfile, $A4clean) <> 1 Then gollog("error writing work file " & @error) EndIf EndFunc ;==>writeWORKfile2 Func readfile2() gollog("reading work file and creating multiD array") If _FileReadToArray($FINALab, $A5clean, Default, ",") = 0 Then MsgBox(48, "errore", @error) EndIf ;_ArrayDisplay($A5clean, "cleaned 2", Default, 8) EndFunc ;==>readfile2 Func preciseremoval($Pclean) ; llllllllllllllllllllllllll ---- pass 1 for ",," $Astring1 = StringToASCIIArray($Pclean) ;_ArrayDisplay($Astring1) $dimSTRING = UBound($Astring1) - 1 Local $salvadelete = "" Local $cond1 = 0 For $y = 0 To $dimSTRING If $cond1 = 1 Then ; , removed so exit from loop If $Astring1[$y] = "34" Then ; terzo step " in chiusura ; gollog('Found right "') If $salvadelete = "" Then $salvadelete = String($y) Else $salvadelete = $salvadelete & ";" & $y EndIf $cond1 = 0 ExitLoop EndIf EndIf If $cond1 = 1 Then If $Astring1[$y] = "44" Then ; secondo step , If $salvadelete = "" Then $salvadelete = String($y) Else $salvadelete = $salvadelete & ";" & $y EndIf EndIf EndIf If $Astring1[$y] = "34" And $cond1 = 0 Then ;PRimo step per primo ->" $cond1 = 1 ;gollog('Found left "') If $salvadelete = "" Then $salvadelete = String($y) Else $salvadelete = $salvadelete & ";" & $y EndIf ;Gollog("debug" & $salvaApici) EndIf Next ; Gollog("apici e virgole da togliere: " & $salvadelete) ;gollog("virgole togliere: " & $salvaVirgole) If _ArrayDelete($Astring1, $salvadelete) = -1 Then Gollog("error in arraydelete apici " & @error) gollog(StringFromASCIIArray($Astring1)) Else gollog(' PASS 1 removed unwanted ",," from line ') EndIf $Astring2 = StringFromASCIIArray($Astring1) $Pclean = $Astring2 Return $Pclean EndFunc ;==>preciseremoval You will need the OutlookEX.au3 ,  look at this link and also my logging UDF  _Gollog.au3, attached.
      Used on Outlook  from 2010 to 2016/365 with no problems.
      Hope this script can help someone.
       
      TEST1.csv _GOLLOG.au3
×
×
  • Create New...