I just started learning HTA and VBScript on my own a few weeks ago by starting this program for work. I'm still a novice so forgive me if this is a dumb question. I've been searching for two hours and either I'm incompetent or I have no idea how to search for the question.
I need this script to check for three files; if all three exist, the script will continue, if one is missing then a dialogue box will pop up telling the user which one is missing. I have looked at what feels like fifty different ways of doing this but none of them work for me. The following method is the only one that does not return any errors, the problem is it doesn't do anything at all, it's just a blank window. (I'm testing this by only checking for one file first)
<SCRIPT LANGUAGE="VBScript">
' Resize and center the window
' ==========================================================
sub DoResize
window.resizeTo 350,250
screenWidth = Document.ParentWindow.Screen.AvailWidth
screenHeight = Document.ParentWindow.Screen.AvailHeight
posLeft = (screenWidth - 350) / 2
posTop = (screenHeight - 250) / 2
window.moveTo posLeft, posTop
end Sub
DoResize()
</SCRIPT>
<TITLE>Test</TITLE>
<HTA:APPLICATION
Id="oInstall"
APPLICATIONNAME="Test"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
SELECTION="NO"
CONTEXTMENU = "NO"
BORDER="Dialogue"
BORDERStyle = "Normal"
INNERBORDER = "YES"
NOWRAP
SYSMENU = "YES"
>
<HEAD>
<STYLE type=text/css>
textarea {
overflow: hidden;
color: #ffffff;
border: none;
background-color: transparent;
}
</STYLE>
<body background="c:\mount\windows\system32\aopentools\Images\MSCBG.bmp">
</HEAD>
<textarea name="ProgSect" rows=1 cols=16 readonly></textarea><img src="c:\mount\windows\system32\aopentools\images\mscind.gif">
<SCRIPT LANGUAGE="VBScript">
Option Explicit
Sub Check
' Creating objects
' ==========================================================
Dim WshShell
Dim objFSO, outFile
Dim filesys
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set filesys = CreateObject("Scripting.FileSystemObject")
Set oFSO=CreateObject("Scripting.FileSystemObject")
' ==========================================================
If oFile=oFSO.FileExists("c:\users\jgainey\desktop\test.txt") Then
BeginImage
Else
MsgBox "An Error Has Occurred" & vbNewLine & "EC03: Test.txt" & vbExclamation & "ERROR"
Window.Close
End If
End Sub
Sub BeginImage
' Creating objects
' ==========================================================
Dim intWindowStyle
Dim bWaitOnReturn
Dim objShell
Dim WshShell
Dim objFSO, outFile
Dim filesys
Set objShell = CreateObject("Wscript.Shell")
Set WshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set filesys = CreateObject("Scripting.FileSystemObject")
set oFSO=CreateObject("Scripting.FileSystemObject")
set oFile=oFSO.OpenTextFile("c:\users\jgainey\desktop\test.txt",1)
text=oFile.ReadAll
document.all.ProgSect.value=text
End Sub
</SCRIPT>
</BODY>
</HTML>
The result is a window with my background image, my .gif, my text area and that's it, the text area never populates. When I remove the test.txt file no message box pops up, nothing is impacted whatsoever.
You forgot to set up the event so that the Sub Check runs on page load, like so:
<body background="c:\mount\windows\system32\aopentools\Images\MSCBG.bmp" onload="Check">
Edit
Error free implementation of the Sub Check method:
Sub Check
' Creating objects
' ==========================================================
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
' ==========================================================
If oFSO.FileExists("c:\users\jgainey\desktop\test.txt") Then
BeginImage
Else
MsgBox "An Error Has Occurred" & vbNewLine & "EC03: Test.txt" & vbExclamation & "ERROR"
Window.Close
End If
End Sub
Related
I just add a menu onche you clic on the draw maker in draw.py toolbar
I modified the html of the map using this code
{{ this._parent.get_name() }}.on('draw:drawstart', function(e){
var type = e.layerType,
layer = e.layer;
if (type === 'marker') {
console.log('drawing starting... ' + e.layer)
// Do marker specific actions
var html = "<br><li class=''><a class='' title='Ubicacion de mujeres'>Ubicacion de mujeres</a></li><br>" +
"<li class=''><a class='' title='Zona de Violencia'>Zona de Violencia</a></li><br>" +
"<li class=''><a class='' title='Poblaciones diversas'>Poblaciones diversas</a></li><br>";
document.querySelector(".leaflet-draw-actions").innerHTML += html;
}
});
What i'm trying to do is to add a menu so the user can create a marker depending on what type of layer you choose previously
my idea es in this image here
When i do this, the "cancel operation" does not work anymore and also i dont know how to change the color of the marker draggable that it is displayed.
Any idea will be so helpful
Thank you and regards!
I am using the following script :
header = self.document.add_paragraph(style='Heading 1')
header.style.font.name = 'Arial'
header.style.font.size = Pt(16)
header.add_run('Header One')
The result is that "Header One" get 'Calibri'.
This is a legitimate bug even with python-docx version 0.8.5. If you were to change the font name of the style 'Normal', it works (as shown in the examples on the python-docx manuals), but this does not work for the 'Heading 1' style.
One workaround is to create a new heading style that takes Heading 1 as a base style and then modify the new style's font name & size:
from docx.enum.style import WD_STYLE_TYPE
styles = self.document.styles
new_heading_style = styles.add_style('New Heading', WD_STYLE_TYPE.PARAGRAPH)
new_heading_style.base_style = styles['Heading 1']
font = new_heading_style.font
font.name = 'Arial'
font.size = Pt(16)
self.document.add_paragraph('Header One', style='New Heading')
I am new in appcelerator. I want to insert html template in message property of alert dialog. When add message as a string it's working fine but i want to insert html template. what i tried so far mention bellow, but its not working.
var win1 = Titanium.UI.createWindow({
backgroundColor:'#F00'
});
var mybutton=Ti.UI.createButton
(
{top: 100,title: 'Push Me'}
);
win1.add(mybutton);
var a = Titanium.UI.createAlertDialog({
title:'Alert Test',
message:'Hello World'
});
Ti.API.info('Alert title: ' + a.getTitle() + ' : ' + a.title);
Ti.API.info('Alert message: ' + a.getMessage() + ' : ' + a.message);
mybutton.addEventListener('click', function(e)
{
a.show();
}
);
win1.open();
I want to show below template in alert dialog
Appcelerator is not an HTML-based environment, like PhoneGap. Appcelerator/Titanium exposes native controls in a JavaScript environment. You can't do what you want natively (the UIAlert/Alert classes support text, not HTML). So, you can't do that in Titanium. Spend a little time reading the docs and checking out the samples you'll find there.
To create the screen you show in your question, you'll need to create a View containing Labels, TextFields, TextAreas, and Buttons. I know, that probably sounds like all HTML stuff. But it's not, those will be representations of native components.
I am generating pdf for my client application using TCPDF by customising footer. My Client wants to show data in footer which are dynamic along with the page number. The problem I am facing is when the data becomes longer than the pdf width the data doesnt move to the next line and some texts are getting cropped.
Can somebody suggest me solution by which I can shift some text to new line? similar to the one be do in HTML by adding <br>.
Or
Is there a way by which the text moves to next line automatically when the length of the text in footer exceeds the pdf width?
Extend the class as per example 3 or use the following code
class MYPDF extends TCPDF {
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
$foot = 'Line 1 \n Line 2 \n 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages()';
$this->MultiCell(0, 10, $foot, 0, 'C');
}
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
I want to save a value from a TextBox, an item of text from the SelectedIndex of a ComboBox and a CheckBox checked true or false. I then want to recall the saved settings with the OnClick from a button. I've had a go with the TextBox below but I get the following error statement: KeyNotFoundException was unhandled by user code. The given Key was not in the present dictionary?
Can anybody help me?
Private Sub Button2_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button2.Click
Dim Store As IsolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings
IsolatedStorageSettings.ApplicationSettings(TextBox1.Text) = TextBox1
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button3.Click
TextBox1 = (IsolatedStorageSettings.ApplicationSettings(TextBox1.Text))
End Sub
The ApplicationSettings works similar to a Hashtable. It requires a key to identify any setting you wish to store.
You can store your setting like this (air code):
IsolatedStorageSettings.ApplicationSettings("MyTextBoxKey") = TextBox1.Text
And you can retrieve your setting like this:
TextBox1.Text = CStr(IsolatedStorageSettings.ApplicationSettings("MyTextBoxKey"))
You can read more about the ApplicationSettings on MSDN