How to activate randomized filenames in powermail - random

i have a form where user could upload files. There are 3 files they could upload and each of them need to have an unique name. So even the person upload the same file everytime i neet different names for it in the email, i get from the form.
So i try to use randomizeFileName.
https://github.com/einpraegsam/powermail/blob/develop/Configuration/TypoScript/Main/setup.txt#L538
Cause i dont have the randomizeFilename in my constants.txt it try to enter it in my setup.txt with a real value.
# File upload settings
file {
folder = {$plugin.tx_powermail.settings.misc.uploadFolder}
size = {$plugin.tx_powermail.settings.misc.uploadSize}
extension = {$plugin.tx_powermail.settings.misc.uploadFileExtensions}
randomizeFileName = 1
}
But sadly that dont work. The file issues-1.pdf still has the same name (+ a suffix cause i tried it a lot time )
I hope someone can help me. Thank you very much!

Based on the setup file included in the extension, the correct syntax for Powermail 7.x would be:
plugin.tx_powermail.settings.misc.randomizeFileName = 1
randomizeFileName = 1 is the default value in Powermail 7.x!
You have to set this over Typoscript Constant, not in Typoscript Setup:
In Typoscript Setup this may work. (Not Tested)
plugin.tx_powermail.settings.Pi2.misc.file.randomizeFileName = 1
Read the source code to see more:
https://github.com/einpraegsam/powermail/blob/develop/Configuration/TypoScript/Powermail_Frontend/setup.txt
Or the documentation: https://docs.typo3.org/typo3cms/extensions/powermail/stable/ForAdministrators/BestPractice/MainTypoScript/Index.html

Related

How to rename the title of the HTML Report generated by pytest-html plug in?

I am generating html report using pytest-html plugin. I'm executing the pytest file by giving "pytest --html=report.html" in command line.
So the name and title of the html report generated is report.html. I want to change the title of the generated report.
Please let me know, how to do that?
Since v2.1.0, this plugin exposes a hook called before adding the title to the report. You can add this to conftest.py:
def pytest_html_report_title(report):
report.title = 'your title!'
This is also explained in the plugin's User Guide.
create conftest.py file in the same folder of the test.
this file is used to configure pytest.
put this snippet inside
def pytest_html_results_summary(prefix, summary, postfix):
prefix.extend([html.h1("A GOOD TITLE")])
if you need to change the html report file name you can try something like this
# #pytest.hookimpl(tryfirst=True)
def pytest_configure(config):
# to remove environment section
config._metadata = None
if not os.path.exists('reports'):
os.makedirs('reports')
config.option.htmlpath = 'reports/' + datetime.now().strftime("%d-%m-%Y %H-%M-%S") + ".html"
my example will put the report.html file in a folder called reports naming with a date instead of a static name
From what I see in the code there is no mean to change only the report's title yet, it is for now hardcoded as
html.h1(os.path.basename(self.logfile))
So the report title will always be the report file name. I've just pushed a merge request to the project to add a new hook to allow the change of the title without changing the file name, we will see if it is accepted.

Access the Android Special Folder Path by using Environment

I want to save my logs to a folder which I can access with windows explorer. For example I want to create my log in the following path
This PC\Galaxy A5 (2017)\Phone\Android\data\MyApp\files
So I tried to use Environment variables... I get such as
/data/user/...
But here i cannot see the file what I created (using code I can access the path but I want to see in the explorer).
how I can create a path like above with code?
When I tried this code
var finalPath2 = Android.OS.Environment.GetExternalStoragePublicDirectory
(Android.OS.Environment.DataDirectory.AbsolutePath);
I get the path "/storage/emulated/0/data"
and
If i use the code
var logDirectory =Path.Combine(System.Environment.GetFolderPath
(System.Environment.SpecialFolder.ApplicationData),"logs");
I get the following path like:
/data/user/0/MyApp/files/.config/logs
and
var logDirectory =Path.Combine(System.Environment.GetFolderPath
(System.Environment.SpecialFolder.MyDocuments),"logs");
"/data/user/0/IM.OneApp.Presentation.Android/files/logs"
but unfortunately I cannot access this folder by explorer....
This PC\Galaxy A5 (2017)\Phone\Android\data\MyApp\files
So how to find out this path in c# by using environments?
Update:
when I give the following path hardcoded, it creates the file where I want..
logDirectory = "/storage/emulated/0/Android/data/MyApp/files/logs";
is there any environment to create this path? I can combine 2 environments and do some string processing in order to create this path. But maybe there is an easier way?
You are looking for the root of GetExternalFilesDir, just pass a null:
Example:
var externalAppPathNoSec = GetExternalFilesDir(string.Empty).Path;
Note: This is a Context-based instance method, you can access it via the Android application context, an Activity, etc... (see the link below to the Android Context docs)
Shared storage may not always be available, since removable media can be ejected by the user. Media state can be checked using Environment.getExternalStorageState(File).
There is no security enforced with these files. For example, any application holding Manifest.permission.WRITE_EXTERNAL_STORAGE can write to these files.
re: https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String)
string docFolder = Path.Combine(System.Environment.GetFolderPath
(System.Environment.SpecialFolder.MyDocuments), "logs");
string libFolder = Path.Combine(docFolder, "/storage/emulated/0/Android/data/MyApp/files/logs");
if (!Directory.Exists(libFolder))
{
Directory.CreateDirectory(libFolder);
}
string destinationDatabasePath = Path.Combine(libFolder, "temp.db3");
db.Backup( destinationDatabasePath, "main");

Add hyperlinked image to email signature using vbscript, using str string

I realize this has been answered numerous times in the past, but I'm just having an issue with the final step of my hyperlinked icon in an email signature
I am adding my image and hyperlinking using the code below which works great, but I need to substitute the actual URL with an attribute from AD. I currently use strLinkedin = objUser.homePhone (I use home.Phone which is where I put the user's personal linkedin URL) and this works fine when I want to use strLinked, but I cannot seem to use it in the code below as the URL.
CODE - for images with a fixed URL (this works fine):
set objShape = objSelection.InlineShapes.AddPicture("\\path\share\4.png")
objSelection.Hyperlinks.Add objShape, "https://twitter.com/example";
Need to have it similar to (this doesn't work obviously, it just makes the link the show strLinkedIn):
set objShape = objSelection.InlineShapes.AddPicture(" \\path\share\4.png")
objSelection.Hyperlinks.Add objShape, "strLinkedIn"
Using the code just above, the output shows the text strLinkedin rather than the result of strLinkedin = objUser.homePhone.
If someone could please possibly help me with the final 'tweak' that would really be appreciated.
Fixed, code is:
strLinkedin = objUser.homePhone
set objShape = objSelection.InlineShapes.AddPicture("\path\share\4.png")
objSelection.Hyperlinks.Add objShape, strLinkedIn
Simply, no "".

How to create the path to desktop for the target user..in C#.net

I am developing image extraction application in .net using C# in VS2010.
i have created a path ,where the image will be extracted.But this path is specific to my system.
string image1 = "c:\\Users\\Raghu\\Desktop\\r.bmp";
I want a path which should be general i.e when the project will be deployed ,the output file should be extracted in Target Users desktop.
how create a folder on desktop and and all my extracted files goes in it.
Any ideas! please help me!!
Next code will return path to the desktop of current user:
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
So, in your case it would be
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string image1 = System.IO.Path.Combine(desktop, "r.bmp");
Environment.SpecialFolder (http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx) contains many definitions of system folder paths. Take a look which you need.
You would use the DesktopDirectory for Environment.SpecialFolder. Something like this:
public static string GetDesktopDirectory()
{
return Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
}
Then using the result of that method, you can use Path.Combine to append a file name to it.
var myFilePath = Path.Combine(GetDesktopDirectory(), "r.bmp");
Path.Combine is the general solution for this, as directly concating strings may result in double slashes, etc. This takes care of that for you.

ms access linked image relitive path

I have an Image object.
I have the Picture type set to linked, so I can change the picture if I want.
I have the Picture property set to the picture name.
I would think that access would use relitive addressing and simple looking in the current directory for the image. But it does not and I get an error telling me it cannot find the picture.
Anyone have a solution? (Other than setting the Picture type to embedded or using the full file address?)
Thanks!
Update:
Tried this:
Private Sub Form_Load()
Dim file As String
file = CurrentDb().Name
file = Replace(file, ".mdb", ".bmp")
Me.Image46.Picture = file
End Sub
It works, except I still get the error message. I click O.K. and it works. Just need the error message to go away.
SOLUTION: Use the above code (or the code posted in the answer below) and then set the 'picture type' to "embedded" and then delete the 'picture' field so that it says "(none)".
Save and run.
It should work.
THANKS!
You could set the property on the forms OnLoad event like this
Me.imgMy_image.picture=getDBPath & “mypicture.bmp”
Here is the getDBPath function
Public Function GetDBPath() As String
Dim strFullPath As String
Dim I As Integer
strFullPath = CurrentDb().Name
For I = Len(strFullPath) To 1 Step -1
If Mid(strFullPath, I, 1) = "\" Then
GetDBPath = Left(strFullPath, I)
Exit For
End If
Next
End Function
Before anyone comments yes I know in access 2000 and above you can use currentproject.path but I’m stuck in the land that time forgot so need that custom function, it still works with later versions of access
Current folder depends of the way you open database in Access. At least, if you open it thru "File-Open", current folder changes to the folder of MDB file. But if you open via double-clicking MDB in explorer, it does not.

Resources